Switch between PHP versions on OS X Mountain Lion
Even if I may get downvotes for this answer, I think I have to post it for the benefit of the OP.
Surely there is a way to achieve what you want, but you will lose a lot of time.
I often develop web applications on my OSX box and guess what... I use a Debian virtual machine to test them on a Webserver. It's easier, faster, neater. I don't need MacPorts to install even four different versions of PHP, I can test all the pecl
extensions compiling them with a simple command. I can simulate any possible Linux server environment with just a few commands in the virtual machine console, without hacking the sources to make them work under OSX, and without screwing anything up.
For anyone wanting to do it with Homebrew: After successfully installing different versions of php (or any program versions) on can switch between them from the command line:
brew unlink php53 && brew link php54
Some more tips here: https://github.com/mxcl/homebrew/wiki/Tips-N%27-Tricks