| Mon, 2009-06-15 21:30 — David Herron |
MAMP makes it pretty darn simple to do web development on a Mac. While Mac OS X comes bundled with Apache and PHP, MAMP bundles together the latest versions of both along with MySQL. It "installs a local server environment in a matter of seconds on your Mac OS X computer" and is completely self-contained. You can run MAMP alongside the Apache that's built-in to Mac OS X, you can remove MAMP at any time, etc. It's very convenient and flexible.
By default you access the MAMP webserver on non-standard ports. Instead of the default webserver port 80, you access http://localhost:8888/ and likewise the bundled MySQL is on port 8889 rather than whatever the default MySQL port is.
It's pretty simple to get going, however there are a couple small gotcha's to running Drupal within the MAMP setup.
On drupal.org is a couple pages going into setting up a fresh Drupal install within MAMP: Installing Drupal on a local MAMP setup (mac) and HowTo: Create a local environment using MAMP. The steps are to
/Applications/MAMP/htdocs//Applications/MAMP/conf/php4/php.ini and /Applications/MAMP/conf/php5/php.ini find the line reading memory_limit = 8M and change the 8M to something more reasonable like 64M
There are some optional steps you may find helpful.
You may want your web files to be in your home directory, and for example to have multiple web directories if you're working on multiple web sites.
You may want to try different PHP versions or caching technologies or the Zend Optimizer. Those are selected in the PHP tab.
You may want to run Apache or MySQL on different ports than 8888 and 8889. Those are selected in the Ports window.
You may want to run an existing Drupal setup on your local machine. For example I keep a local copy of my website so I can hack on the site without bothering the live site. There are several steps that are largely the same as above.
One things to note is that MAMP bundles command line utilities for MySQL. They are in /Applications/MAMP/Library/bin/ and you can either specify the full path as I've done above, or to add that directory to your PATH.
Another thing is the $db_url. MAMP delivers it's MySQL with user and password set to 'root' and it's pretty easy to leave that setting alone rather than create another MySQL user. That's configured in the $db_url with the 'root:root' part. I couldn't find in settings.php documentation how to specify the MySQL port. However setting the ':8889' in the $db_url worked.
If the MySQL on your webserver doesn't allow remote MySQL access you may need further tricks. The step above to dump the remote database relies on the local mysqldump being able to access the remote server. One possible trick is to make a tunnel connection to the remote MySQL server as mentioned in: Using SSH or Putty to remotely access a MySQL server