The scope of this article is to discuss the possible configurations with Apache httpd 2.2 and php. Using mod_php in most cases is not a viable solution, since it introduces scalability issues with the added RAM requirement for each httpd process. Additionally, it precludes the use of threaded MPMs since php extensions are not thread-safe in many cases.

The ideal configuration is a light threaded httpd process that communicates with an external fastcgi server, such as PHP-FPM.

The first recipe uses mod_fastcgi:

Alias /php5.fcgi /var/www/fcgi/php5.fcgi

FastCGIExternalServer /var/www/fcgi/php5.fcgi -flush -host

# Invent a new handler name and use it for PHP files

AddHandler my-fastcgi .php

# Requests for *.php are actually fed to php-fastcgi as an argument

Action my-fastcgi /php5.fcgi

<Directory "/var/www/fcgi/">

{{ Order deny,allow}}

{{ Deny from all}}

{{ <Files "php5.fcgi">}}

{{ Order allow,deny}}

{{ Allow from all}}

{{ </Files>}}


Thanks to Guillaume Seigneuret for the kickstart on that recipe!

  • No labels