I want to use fastcgi in apache2 with php(5.3.8).

I installed fastcgi_module in apache, and compiled php with--enable-fpm. I also found some tutorials,there were two methods in their settings:

FastCgiServer /usr/local/apache2/fcgi-bin/php-cgi -processes 10


FastCgiExternalServer /usr/local/apache2/fcgi-bin/php-cgi -host

But I can not find the php-cgi in php 5.3.8. what should I do next? How to set the httpd.conf when using php-fpm with php(5.3.8) and apache2?

1 Answer 1


The secret here is that php-cgi is nto a real file, it's a wrong file name use internally in Apache. You could call it as well : false-php-cgi-catcher-which-do-not-exists.

I wrote a complete php-fpm+apache2.2+chroot install guide a few days ago here. You may have a look. But try to get it working without the chroot first. Note that starting with apache 2.3 the best tool for php-fpm will be mod_proxy_fcgi

Here's an extract of the complete install guide. I use php5.external where you want to use php-cgi.

# phpfpm/fastcgi
# Here we catch the 'false' Location used to inexistent php5.external
# and push it to the external FastCgi process via a socket
# note: socket path is relative to FastCgiIpcDir
# which is set in Main configuration /etc/apache2/mods-available/fastcgi.conf
<IfModule mod_fastcgi.c>
    # all .php files will be pushed to a php5-fcgi handler
    AddHandler php5-fcgi .php

    #action module will let us run a cgi script based on handler php5-fcgi
    Action php5-fcgi /fcgi-bin/php5.external

    # and we add an Alias to the fcgi location
    Alias /fcgi-bin/php5.external /php5.external

    # now we catch this cgi script which in fact does not exists on filesystem
    # we catch it on the url (Location)
    <Location /fcgi-bin/php5.external>
        # here we prevent direct access to this Location url,
        # env=REDIRECT_STATUS will let us use this fcgi-bin url
        # only after an internal redirect (by Action upper)
        Order Deny,Allow
        Deny from All
        Allow from env=REDIRECT_STATUS
FastCgiExternalServer /php5.external -socket myapplication.sock -appConnTimeout 30 -idle-timeout 60

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy