Apache + PHP via FastCGI
- by Wilco
I'm running into some problems while attempting to run PHP via FastCGI in Apache. I have the FastCGI module loaded, but get the following error when attempting to load a page:
The requested URL /fastcgi/php54.fcgi/index.php was not found on this server.
Somewhere, it seems that the script to be executed is appended to the executable without any spaces. Is this where the problem likely is? Below I've included snippets from my Apache configuration (hopefully this is enough):
LoadModule fastcgi_module libexec/apache2/mod_fastcgi.so
FastCgiIpcDir /var/run/fastcgi
AddHandler fastcgi-script .fcgi
FastCgiConfig -autoUpdate -singleThreshold 100 -killInterval 300
AddType application/x-httpd-php .php
ScriptAlias /fastcgi/ /Library/WebServer/FCGI-Executables/
<Directory "/Library/WebServer/FCGI-Executables">
Options +ExecCGI
SetHandler fastcgi-script
Order allow,deny
Allow from all
<VirtualHost *:80>
ServerName www.somedomain.com
ServerAdmin [email protected]
DocumentRoot "/Web/www.somedomain.com"
DirectoryIndex index.html index.php default.html
CustomLog /var/log/apache2/access_log combinedvhost
ErrorLog /var/log/apache2/error_log
Action application/x-httpd-php /fastcgi/php54.fcgi
<IfModule mod_ssl.c>
SSLEngine Off
SSLCipherSuite "ALL:!aNULL:!ADH:!eNULL:!LOW:!EXP:RC4+RSA:+HIGH:+MEDIUM"
SSLProtocol -ALL +SSLv3 +TLSv1
SSLProxyEngine On
SSLProxyProtocol -ALL +SSLv3 +TLSv1
</IfModule>
<Directory "/Web/www.somedomain.com">
Options All -Indexes +ExecCGI +Includes +MultiViews
AllowOverride All
<IfModule mod_dav.c>
DAV Off
</IfModule>
<IfDefine !WEBSERVICE_ON>
Deny from all
ErrorDocument 403 /customerror/websitesoff403.html
</IfDefine>
</Directory>
</VirtualHost>
... and this is the executable:
#!/bin/sh
PHP_FCGI_CHILDREN=1
PHP_FCGI_MAX_REQUESTS=5000
export PHP_FCGI_CHILDREN
export PHP_FCGI_MAX_REQUESTS
exec /opt/local/bin/php-cgi54