I'm having trouble deploying a PHP5 application in the following setup with a Gentoo system:

  • Apache 2.2
  • mod_fastcgi
  • PHP5 with fpm (fpm running a pool with an user and group of its own)
  • Django for the top / directory with FastCGI as well (with a runfastcgi process manager)

(this setup has been chosen for security purposes, so we can isolate applications in a fine-grained manner)

Whenever I try to access the PHP5 application I get a blank page with a 404 status:

[28/Dec/2011:07:23:32 -0800] "GET /blah/index.php HTTP/1.1" 404 -

Apache seems to be connecting just fine to the fpm FastCgiExternalServer socket, and no other errors are logged elsewhere. The php-fpm log set to debug reveals nothing strange.

These are the relevant bits of the config:

FastCgiExternalServer /mypath/public_html/djangoapp.fcgi -socket /var/run/djangosocket.sock

FastCGIExternalServer /mypath/public_html/php5-phpapp.fcgi -flush -socket /var/run/php-fpm.phpapp.sock

<VirtualHost 1.2.3.4:80>
        ServerName www.example.org
        <IfModule mpm_peruser_module>
                ServerEnvironment apache apache
        </IfModule>

<Directory "/mypath/public_html">
        Options -Indexes FollowSymLinks SymLinksifOwnerMatch IncludesNOEXEC
        AllowOverride All
        Order allow,deny
        Allow from all

        <Files djangoapp.fcgi>
        Options +ExecCGI
        </Files>
        <Files php5-phpapp.fcgi>
        Options +ExecCGI
        </Files>
</Directory>

Alias /media/ /mypath/djangoapp/my_media/
Alias /phpapp/ /mypath/public_html/phpapp/

<Directory "/mypath/public_html/phpapp">
    AllowOverride All
    Order allow,deny
    Allow from all
    AddType application/x-httpd-fastphp5 .php
    Action application/x-httpd-fastphp5 /php5-phpapp.fcgi
</Directory>

RewriteEngine On
RewriteRule ^/(media.*)$ /$1 [QSA,L,PT]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^/(phpapp.*)$ /php5-phpapp.fcgi/$1 [QSA,L]
RewriteRule ^/(.*)$ /djangoapp.fcgi/$1 [QSA,L]
</VirtualHost>

The Django application serves the top directory and we want the PHP application inside a subdirectory.

The PHP-fpm config:

[phpapp]
prefix = /home/php-fpm/pools/$pool
listen = /var/run/php-fpm.$pool.sock
listen.allowed_clients = 127.0.0.1
listen.owner = phpapp
listen.group = apache
listen.mode = 0664
user = phpapp
group = phpapp
pm = dynamic
pm.max_children = 50
pm.start_servers = 5
pm.min_spare_servers = 5
pm.max_spare_servers = 35
;pm.max_requests = 500

rlimit_core = unlimited
#chroot =  $prefix/chroot
catch_workers_output = yes

What is causing this behavior?

link|improve this question
feedback

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
or
required, but never shown

Browse other questions tagged or ask your own question.