Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Switch between PHP versions on OS X Mountain Lion

Is it possible to have multiple versions of PHP installed on OS X Mountain Lion and freely change between them? Similar to the way MAMP allows you to. I'm wanting to get out of using MAMP and this is really the only feature holding me back.

like image 415
jnettik Avatar asked Sep 17 '12 00:09

jnettik


2 Answers

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.

like image 164
gd1 Avatar answered Sep 25 '22 00:09

gd1


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

like image 30
Robert Brisita Avatar answered Sep 23 '22 00:09

Robert Brisita