In some cases, after installing the web server, the PHP handler may not be connected. The connection method depends on the installed web server.
To enable PHP handler in Apache do the following:
cd /etc/httpd/
ls /etc/httpd/modules/ | grep php
The output should be something like this:
libphp*-zts.so libphp*.so
grep -n 'php' /etc/httpd/conf/*
grep 'Include conf.d\/\*.conf' /etc/httpd/conf/*
echo "Include conf.d/*.conf" >> /etc/httpd/conf/httpd.conf
/etc/httpd/conf/httpd.conf:Include conf.d/*.conf
then additional configuration files are included.ls /etc/httpd/conf*/* | grep php
X
specify the PHP version you want):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
nano /etc/httpd/conf*/*.conf
Specify the desired version instead of the symbol X
in lines like this:
LoadModule phpX_module modules/libphpX.so LoadModule phpX_module modules/libphpX-zts.so AddHandler phpX-script .php
Modify a specific config file depending on the previous step:
/etc/httpd/conf/httpd.conf
./etc/httpd/conf.d/php.conf
.service httpd restart