Last Fixups
The remaining problem is that PHP has a little issue with translating the path information it gets when running as an FCGI server. This results in
$_SERVER['SCRIPT_NAME']
being set to a wrong value. To fix this, we unfortunately have to patch PHP itself, namely the file
sapi/cgi/cgi_main.c
. There, after line 976, add this:
if (env_redirect_url &&
strncmp(env_server_software, "Apache", sizeof("Apache")-1) == 0) {
/*
* If we have an env_redirect_url and the web server is Apache
* it's very likely that env_redirect_url is the one we really
* want
*/
env_script_name = env_redirect_url;
}
This will make sure that the superglobal variable is set to the right value when using Apache 2.2 as your FastCGI frontend server. The patch has been tested with PHP 5.2.9 and 5.2.10 but might work with other versions as well.
Incoming search terms:
- FastCgiExternalServer
- fastcgiexternalserver example
- apache FastCgiExternalServer
- fastcgiexternalserver not allowed here
- scsi_cmnd_start(1045) unsupported 93
- fastcgiexternalserver apache
- FastCGIExternalServer environment variables
- fastcgiexternalserver not working
- FastCGIExternalServer alias
- php fastcgi virtualpath

Pingback: External FastCGI With Apache « IT Know-It-All
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…
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.