Manage cookies that are used for advertising, such as ad personalization, remarketing, and ad effectiveness analysis.
5.3.9. Enable PHP handler for web server
In some cases, the PHP handler may not be enabled after installing the web server. The method for enabling it depends on the web server you have installed.
Apache
- Connect to the server via SSH.
- Go to the web server directory:
cd /etc/httpd/ - Check if the PHP module is installed:
ls /etc/httpd/modules/ | grep phpThe output should look something like this:
libphp*-zts.so libphp*.so - Check the Apache configuration files:
grep -n 'php' /etc/httpd/conf/*- If the previous command did not return any output, check for additional configuration files:
grep 'Include conf.d\/\*.conf' /etc/httpd/conf/*- If the command also didn't produce any output, edit the Apache configuration file by adding an option to load additional configuration files:
echo "Include conf.d/*.conf" >> /etc/httpd/conf/httpd.conf - If the command output was
/etc/httpd/conf/httpd.conf:Include conf.d/*.conf, then the additional configuration files have been included. - Проверьте наличие файла конфигурации PHP:
ls /etc/httpd/conf*/* | grep php- If the previous command didn't produce any output, create a configuration file (replace
Xwith the number of the desired PHP version):cat > /etc/httpd/conf.d/php.conf <<EOF <IfModule prefork.c> LoadModule phpX_module modules/libphpX.so </IfModule> <IfModule !prefork.c> LoadModule phpX_module modules/libphpX-zts.so </IfModule> AddHandler phpX-script .php AddType text/html .php DirectoryIndex index.php php_value session.save_handler "files" php_value session.save_path "/var/lib/php/session" php_value soap.wsdl_cache_dir "/var/lib/php/wsdlcache" EOF
- If the command run in step 4 or 4.1.3 produced an output (which will typically resemble the text shown in step 4.1.3.1), compare the PHP versions listed in the configuration file with the output of the command run in step 3. If they differ, edit the corresponding configuration file and replace the version:
nano /etc/httpd/conf*/*.confReplace the
Xsymbol in the following lines with the appropriate version:LoadModule phpX_module modules/libphpX.so LoadModule phpX_module modules/libphpX-zts.so AddHandler phpX-script .phpDepending on the previous step, modify the appropriate configuration file:
- If the previous step was 4, you need to edit the
/etc/httpd/conf/httpd.conffile. - If the previous step was 4.1.3, you need to edit the
/etc/httpd/conf.d/php.conffile.
- Restart Apache:
service httpd restart- If the restart was successful, check that PHP is working on the sites.
- If errors occur during the restart, check the configuration files for line break issues or incorrect settings.