2013-10-23

Setting up Mac OS X Snow Leopard as an Apache, MySQL, PHP (MAMP) web server

When my old Ubuntu on a laptop web and file server died I decided to set up my Mac Mini with Snow Leopard as its replacement rather than finding another old laptop and building a new Linux server on it. I was afraid setting up an Apache, MySQL and PHP stack on Mac OS X would be complicated and messy, but it turned out to be pretty straightforward thanks to some good guides on the web.

My first step was to follow this how-to from the "Coolest Guides on the Planet" website:

Install and configure Apache, MySQL & PHP on OS X Lion 10.7 and 10.6

Then I followed another guide by the same person for setting up phpMyAdmin:

Installing phpMyAdmin on Mac OSX 10.8 Mountain Lion & 10.7, 10.6

I then went ahead and imported the backup of the database for my home-brewed web apps into MySQL using phpMyAdmin, and copied my PHP files into the web server directory and tested my apps.  I quickly ran into a problem where apps that had been working for years starting throwing fatal errors (sorry, I didn't write down what they were).  After poking around on the web I discovered that the MySQL installer you download from Oracle has STRICT_TRANS_TABLES turned on by default, which can cause problems for apps developed on Ubuntu because STRICT_TRANS_TABLES is turned off by default in Ubuntu.  I followed the directions on this blog post to turn off STRICT_TRANS_TABLES and then everything worked:

MySQL Strict Mode on OS X

After that, everything worked great.

No comments: