Server runs CentOs 6.10
Need to use php5 for some websites and php7 for others on the same server so I used the remi repository and enabled the php versions needed.
I've uninstalled mod_php and installed php-fpm and mod_fcgid.
In /etc/php-fpm.d/www.conf
, I've added:
listen = /var/run/php-fpm/www.sock
listen.group = apache
listen.mode = 0660
I have created /var/www/cgi-bin/php.fastcgi
with the following contents:
#!/bin/bash
PHPRC="/etc/php.ini"
PHP_FCGI_CHILDREN=4
PHP_FCGI_MAX_REQUESTS=1000
export PHPRC
export PHP_FCGI_CHILDREN
export PHP_FCGI_MAX_REQUESTS
exec /usr/bin/php-cgi
Below is an example vhost for a domain:
<VirtualHost *:80>
# Admin email, Server name and Server alias
ServerAdmin test@example.org
ServerName domain.com
# Document Root settings
DirectoryIndex index.php
DocumentRoot /var/www/vhosts/domain.com/httpdocs/
ScriptAlias /cgi-bin/ "/var/www/cgi-bin/"
# Logging settings
LogLevel warn
ErrorLog /var/www/vhosts/domain.com/log/error.log
CustomLog /var/www/vhosts/domain.com/log/access.log combined
</VirtualHost>
I've basically followed this guide but have also tried all sorts of other things from what I've found online, all to no avail.
If I visit a domain on the server, I just get a internal server error or the php is not parsed properly and just output as raw text.
What am I missing in the above configuration?