Using MAMP as a Development Platform
If you're in charge of developing or maintaining a website, it is highly recommended that you maintain a development server- a place where you've got a running duplicate of your site. This provides a place to test and debug site changes without affecting your live production server.
There are numerous strategies for implementing a development server, but my own personal choice is to run a webserver locally on my laptop and manually update local copies of my sites. Ideally, you'll want to get as close as possible to the services and versions on your production server(s).
My production server environment is LAMP (Linux, Apache, MySQL, PHP). This can be easily duplicated in large measure by a MAMP (Mac, Apache, MySQL, PHP) server, which is actually quite easy to set up.
I've recently taken the plunge and upgraded my system to Snow Leopard (OSX 10.6). I was one of those sticks in the mud that was still using 10.4, largely because of my development server.
I had been using 10.4's standard Apache 1.2 and the Entropy PHP package, as well as a local MySQL server.
At the time of this writing, the Entropy package has yet to be updated and debugged for 10.6. The standard installation of PHP 5.3 included with Snow Leopard has more extensions than the version included with 10.5, however some popular extensions are still missing. It is possible to compile and link the desired extensions locally, however finding a quicker solution is tempting.
A standalone package aptly named MAMP promises a "single-click" web server stack. I chose a to do a fresh install of 10.6 on a new hard drive, and opted for MAMP instead of Apple's offerings.
Installation is dead simple, with only a handful of configuration options available. At first, I was a little put off by the simple interface. It works, however, and that's the point.
I made only a few configuration changes.
- I changed the Ports to their typical defaults: 80 for Apache and 3306 for MySQL. (Be sure you have turned off Web Sharing in your control panel)
- I set the Apache root to the "Sites" directory in my user directory (this was my root under 10.4) In order for this to work completely, you'll need to change a line in your httpd.conf and httpd-std.conf files:
was set to
This required me to change the .htaccess files in each of my local websites. For those using URL rewrites, I had to change the RewriteBase to reflect my new site root. For example,
Following this, I imported each of my MySQL databases using PHPMyAdmin. By default, MAMP uses "root:root" as username and password- this is fine for a local server.
Once all my site databases were imported, I tested each site with MAMP running. Several of my Drupal sites required a memory bump: Find the php.ini file in /Applications/MAMP/conf/php5/.
memory_limit = 8 M
memory_limit = 32 M
That's it- running smoothly with no issues so far. I love it when something JUST WORKS!