Use multiple php versions with Mac OSX, Homebrew and Apache

At work, I have to deal with tons of projects, each one having its own requirements.
And it’s unpredictable: sometimes I need PHP5.3, sometimes 5.4, 5.5, or 5.6.

The problem is: with Apache, in a “classic” usage, one uses mod_php.

Here comes the solution: Mac OSX have the great Homebrew to manage dependencies, and all PHP versions are available.

Here is a configuration of Apache and PHP with fast_cgi to have multiple versions of PHP on the same webserver.

All the code of this article can be found in a Gist, if you need to remember all.

Continue reading “Use multiple php versions with Mac OSX, Homebrew and Apache”