Subject: Using PHP4 via FastCGI
To: None <email@example.com>
From: Todd Vierling <firstname.lastname@example.org>
Date: 09/23/2005 12:31:03
In an effort to make my Apache2 threadable, I decided to detach PHP from
Apache by using it in FastCGI mode, based on the talk in the prior thread.
The following worked for me quite well, with the caveat that SCRIPT_NAME is
no longer set the way it was before (but proper PHP4-compatible code should
be using the property PHP_SELF, not SCRIPT_NAME).
- Remove --enable-discard-path and add --enable-fastcgi in www/php4; build
- Removed ap-php and the LoadModule line for it in httpd.conf (and any
AddType or AddHandler lines added for ap-php).
- Install ap2-fastcgi and add the LoadModule line for it in httpd.conf.
- Create a directory, say /usr/local/www/.fastcgi, and symlink
/usr/pkg/libexec/cgi-bin/php into it.
- Add the following in httpd.conf (dynamic mode -- recommended, because
FastCgiServer syntax forces a fixed number of subprocesses):
Alias /.fastcgi/ /usr/local/www/.fastcgi/
Action php-handler /.fastcgi/php
AddHandler php-handler .php
Now PHP works by dynamically forking off php FastCGI instances, and it works
fine, even with a threaded apache2. I have not tried removing
--enable-force-cgi-redirect yet, and I don't know if that has any effect at
all in a FastCGI instalation scheme.
As to the threaded apache2, though, it seems to be taxing my computer
heavily or something, as it is making my 2.1_RC5 kernel hang when it runs
for a while, but I digress....
-- Todd Vierling <email@example.com> <firstname.lastname@example.org> <email@example.com>