I am very new to this php-fpm
thing, but I decided I need to get into it. I recently migrated to Centos 8, and with it to Apache 2.4.
I have a number of virtual hosts using PHP which worked well until I changed from mod_mpm_prefork
to mod_mpm_event
. That broke a number of sites.
One site, I have successfully got working by seeking and destroying any references to php_
values in my .htaccess
file, since PHP is no longer running as a module. I thought that would be the same for the others.
On all of the other sites, I get a 500 server error. Even when I try a trivial script such as:
Hello
<?php
die('goodbye');
all I get is a which screen and a 500 server error.
When I look in the error_log
file, I see nothing helpful:
GET /index.php HTTP/1.1" 500 - "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Firefox/78.0"
When I try to access a non-PHP file, it works well.
As far as I can see, the configuration setting relevant to the setup is in conf.d/php.conf
:
<IfModule !mod_php5.c>
<IfModule !mod_php7.c>
SetEnvIfNoCase ^Authorization$ "(.+)" HTTP_AUTHORIZATION=$1
<FilesMatch \.(php|phar)$>
SetHandler "proxy:unix:/run/php-fpm/www.sock|fcgi://localhost"
</FilesMatch>
</IfModule>
</IfModule>
If I comment out the SetHandler
line the pages work, without PHP of course. I really don’t know how to check whether this line is correct.
I’m sure the fix is simple, but how can I find the cause of the 500 error, and what might be the case of not running a PHP script?