FastCGIExternalServer demystified

« 1 2 3 4 5 6 7 8 9View All»

Apache to the rescue!

Clearly we need a way to seperate the PHP code from all the other stuff in and below the document root. There’s a nice Apache config statement that allows us to du just that:

AddHandler

. So let’s modify our virtual host config a bit:

<VirtualHost *>
    ServerName    fcgi.test.local
    FastCGIExternalServer /fcgi/www/fcgi -host 127.0.0.1:9000
    AddHandler php-fastcgi .php
    DocumentRoot /srv/www/fcgi
    <Directory /srv/www/fcgi>
        AllowOverride   All
        Order           Allow,Deny
        Allow           from all
    </Directoy>
</VirtualHost>

Now, what happened here? First, we changed the (not so virtual) path for the

FastCGHIExternalServer

to point to a new – as of yet non-existant – directory. Thus, the external PHP server will for the moment never be called and therefor it won’t interfere with graphics, CSS and other stuff.
Also, the new

AddHandler

directive instructs Apache to call the Action named

php-fastcgi

for every file with an extenstion of

.php

. So obviously we have to provide this handler using the

Action

directive.


Incoming search terms:

This entry was posted in PHP, Software, the ugly truth and tagged , , . Bookmark the permalink.

3 Responses to FastCGIExternalServer demystified

  1. Pingback: External FastCGI With Apache « IT Know-It-All

  2. Mattes says:

    Great article, but how did you solve the problem with the trailing index.php?
    If I call the domain, the php file are provided as a download.
    If I add index.php, I get redirected to /virtualpath/index.php/ which results in a 404. Everything else works like a charm…

  3. Stefan Rubner says:

    Can’t really say what the problem with your setup is. Either it’s a missing “DirectoryIndex index.php” statement in the htpd.conf file or your settings for calling the FCGI process are a bit borked. If you could post the settings for your vhost, maybe I could help more then.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>