Topic: PHP script not handled in mod_fcgid mode after upgrading to PHP 5.4

Hi,

I have updated PHP to 5.4 on CentOS yesterday and all the PHP script cannot be handled correctly now. I use Apache 2.2 and run PHP through mod_fcgid. What I can see from browser is only the plain text of php source code which is really weird.

Here is configuration file related:


<Directory /home/xxxx/domains/x.xxxx.com/public_html>
Options -Indexes +IncludesNOEXEC +SymLinksifOwnerMatch +ExecCGI
allow from all
AllowOverride All Options=ExecCGI,Includes,IncludesNOEXEC,Indexes,MultiViews,SymLinksIfOwnerMatch
AddHandler fcgid-script .php
AddHandler fcgid-script .php5
FCGIWrapper /home/xxxx/domains/x.xxxx.com/fcgi-bin/php5.fcgi .php
FCGIWrapper /home/xxxx/domains/x.xxxx.com/fcgi-bin/php5.fcgi .php5
</Directory>

RemoveHandler .php
RemoveHandler .php5
php_admin_value engine Off
IPCCommTimeout 31
FcgidMaxRequestLen 1073741824

And php5.fcgi:

#!/bin/bash
PHPRC=$PWD/../etc/php5
export PHPRC
umask 022
export PHP_FCGI_CHILDREN
PHP_FCGI_MAX_REQUESTS=99999
export PHP_FCGI_MAX_REQUESTS
SCRIPT_FILENAME=$PATH_TRANSLATED
export SCRIPT_FILENAME
exec /usr/bin/php-cgi 

Could someone help me find where the cause is?

Re: PHP script not handled in mod_fcgid mode after upgrading to PHP 5.4

I'm not used to configure fcgi, but a simple test works for me

<Location />
AddHandler fcgid-script .php5
Options +ExecCGI
FCGIWrapper /var/www/html/fcgi .php5
</Location>

And same wrapper than your (except PHPRC)

Desktop: Fedora 35 + rpmfusion + remi-test + remi-dev
Laptop:  Fedora 36 + rpmfusion + remi (SCL only)
Hosting Server: CentOS 8 Stream with EPEL, rpmfusion, remi

Re: PHP script not handled in mod_fcgid mode after upgrading to PHP 5.4

The only change in provided apache configuration is about mod_php (more secured), but if you use fcgi, I think you don't have mod_php (php package) installed...

Desktop: Fedora 35 + rpmfusion + remi-test + remi-dev
Laptop:  Fedora 36 + rpmfusion + remi (SCL only)
Hosting Server: CentOS 8 Stream with EPEL, rpmfusion, remi

Re: PHP script not handled in mod_fcgid mode after upgrading to PHP 5.4

Remi wrote:

The only change in provided apache configuration is about mod_php (more secured), but if you use fcgi, I think you don't have mod_php (php package) installed...

Do you mean /etc/httpd/conf.d/php.conf file? I'm using Virtualmin so both mod_php and mod_fcgid installed on my server, which can be switched by user.

Re: PHP script not handled in mod_fcgid mode after upgrading to PHP 5.4

php.conf now use a "FilesMatch + SetHandler" (more secure) directives rather than the old AddHandler.

It seems it could have some conflicts (as Files are analysed after Directory)

Try to comment all the php.conf stuff to see if this solves the issue
And also try with the old

AddHandler php5-script .php

P.S. in my test config, I use mod_php for .php and fcgi for .php5, it works.

Desktop: Fedora 35 + rpmfusion + remi-test + remi-dev
Laptop:  Fedora 36 + rpmfusion + remi (SCL only)
Hosting Server: CentOS 8 Stream with EPEL, rpmfusion, remi

Re: PHP script not handled in mod_fcgid mode after upgrading to PHP 5.4

It works! big_smile

I comment out the new SetHandler and use the legacy AddHandler, everything looks fine. But don't know why...

Thank you Remi!

Re: PHP script not handled in mod_fcgid mode after upgrading to PHP 5.4

Great !

Desktop: Fedora 35 + rpmfusion + remi-test + remi-dev
Laptop:  Fedora 36 + rpmfusion + remi (SCL only)
Hosting Server: CentOS 8 Stream with EPEL, rpmfusion, remi