Lately I needed to test some code against PHP version 5.3 wich is (hopefully not forever) the highest supported version on one of my clients hosting right now. To cut the story short, I develop and test on a local MAMP server, usualy for PHP v5.4+. The free version of MAMP will let you run either v5.4.4 or v5.2.17 of PHP. To run other version you need to purchase MAMP Pro. But I haven't read/heard a single person saing about MAMP Pro worth its price tag.
My MAMP installation comes with many PHP versions preinstalled. See /Applications/MAMP/conf
(Cmd+G), but you can swich only between two: the lowest and the heighest version of PHP. No option between. There are these versions in my MAMP/conf
folder:
- php5.2.17
- php5.3.5
- php5.3.13
- php5.3.14 (I need this one to test against)
- php5.4.3
- php5.4.4
The thing is, that what version of PHP is being used is defined in /Applications/MAMP/conf/apache/httpd.conf
in this directive:
LoadModule php5_module /Applications/MAMP/bin/php/php5.4.4/modules/libphp5.so
You go and edit it to something else:
LoadModule php5_module /Applications/MAMP/bin/php/php5.3.14/modules/libphp5.so
Soon you'll find out, that MAMP is rewriting your previously stored setting on each server start.
- Head to Finder, hit Cmd+G (Go) and enter
/Applications/MAMP/conf/apache
- find the
http.conf
, hit Cmd+I (File Info) - Lock the file
- Done
Happy testing with various versions of PHP!