[php-maint] Updating php5 to 5.4.4-5 broke FastCGI setup on my machine

Konstantin Khomoutov flatworm at users.sourceforge.net
Mon Sep 17 14:35:10 UTC 2012


On one of my machines running Debian Wheezy, I have PHP scripts being
served using FastCGI by means of the stock mod_fcgid module.

To configure this, I created the file

/etc/apache2/conf.d/fcgid-php5.conf

which contains this snippet:

<IfModule mod_fcgid.c>
  AddHandler   fcgid-script .php
  FCGIWrapper  /usr/bin/php-cgi .php
  #DefaultInitEnv PHP_FCGI_MAX_REQUESTS 500
  #MaxRequestsPerProcess 500
</IfModule>

After applying the recent pack of updates, which included
php5-cgi 5.4.4-7
php5-cli 5.4.4-7
php5-common 5.4.4-7
php5-sqlite 5.4.4-7
I found Apache serving PHP files "as is" without even specifying any
Content-Type among the HTTP headers.

After certain amount of trial and error, I concluded that the offending
change is the inclusion of

<FilesMatch ".+\.ph(p[345]?|t|tml)$">
    SetHandler application/x-httpd-php
</FilesMatch>

to the file /etc/apache2/mods-enabled/php5_cgi.conf which has
apparently been introduced in 5.4.4-5.

I suspect this is the culprit as I managed to fix the configuration for
one of my vhosts by adding a sort-of "override entry" to the <Directory>
section of that vhost, which now looks like this (<FilesMatch ...> is
what I added):

<Directory /usr/share/phpmp>
    Options +ExecCGI +Indexes
    <FilesMatch ".+\.ph(p[345]?|t|tml)$">
        SetHandler fcgid-script
        FcgidWrapper  /usr/bin/php-cgi
    </FilesMatch>
</Directory>

I'm by no means an expert in setting up this sort of complicated stuff
in Apache, so I can't really tell if this new change in php5 packaging
introduces a regression or it's just a misconfiguration on my part.
In the latter case, it would be cool if someone could provide me with
any hints on how to configure handling of PHP scripts by FastCGI
server-wide (rather than patching each PHP-enabled vhost using that
<FilesMatch> override).  Any suggestions?

Please Cc me as I'm not subscribed.



More information about the pkg-php-maint mailing list