<VirtualHost *:80>
ServerName 127.0.0.1
DocumentRoot /var/www/
<Directory /var/www/>
# These two lines are mandatory to run php on this vhost
AddHandler php-cgi .php
Action php-cgi /php-fcgi/php56
# This is up to you, actually...
AllowOverride all
Options Indexes FollowSymLinks MultiViews
</Directory>
ErrorLog /var/www/apache_error.log
CustomLog /var/www/apache_access.log combined
</VirtualHost>
$ brew update && brew pull https://github.com/mxcl/homebrew/pull/12093
$ brew install mod_fastcgi
Read the other files of this gist.
#!/bin/bash
# You can change the PHP version here.
version="5.6"
shortversion="56"
# php.ini file location on Mac OSX with homebrew
PHPRC=/usr/local/etc/php/${version}/php.ini
export PHPRC
PHP_FCGI_CHILDREN=3
export PHP_FCGI_CHILDREN
PHP_FCGI_MAX_REQUESTS=5000
export PHP_FCGI_MAX_REQUESTS
# Which binary to execute
exec /usr/local/opt/php${shortversion}/bin/php-cgi
# Mac OSX + Homebrew + mod_fastcgi + php-cgi
LoadModule fastcgi_module /usr/local/opt/mod_fastcgi/libexec/mod_fastcgi.so
<IfModule fastcgi_module>
AddHandler fastcgi-script .fcgi
# Directory has to be created
FastCgiIpcDir /usr/local/lib/apache2/fastcgi
FastCgiConfig -idle-timeout 110 -killInterval 120 -pass-header HTTP_AUTHORIZATION -autoUpdate
# Each file is a bash script running php-cgi
# You may create them all and uncomment all lines if you have all php versions installed...
#FastCgiServer /www/cgi-bin/php53.sh
#FastCgiServer /www/cgi-bin/php54.sh
#FastCgiServer /www/cgi-bin/php55.sh
#FastCgiServer /www/cgi-bin/php56.sh
#FastCgiServer /www/cgi-bin/php70.sh
ScriptAlias /php-fcgi/ /www/cgi-bin/
</IfModule>