Installing PHP, MySQL and MacPorts on Snow Leopard

Funny. I drafted this in January and kept coming back to it when I had to do a fresh wipe and install back in September. Since it’s still in the draft archives, I thought I’d pull it back out in case it helps someone else.

It’s been a long month recovering from a corrupt hard drive and many lessons have been learned. Since my track record is 1 computer corruption/data-loss/water-spill/theft per year, I’ve decided to document so next time I’m only out a few hours.

(1) INSTALL PHP & MySQL: Followed the incredibly easy steps at http://maestric.com/doc/mac/apache_php_mysql_snow_leopard

(SNAG) Ran into a snag with MySQL, as I kept getting an error when trying to start it. It wouldn’t start in the preference pane, nor at the command line.

(SOLUTION) Download the correct version for my Airbook. Intel Macs (AirBook, PowerBook, etc.) are x86

(2) Fix php.ini: I still had to fix the socket locations as defined in php.ini – but that was easy, thanks to maestric (see link above)

(3) Install MacPorts: Followed the instructions @ http://www.macports.org/install.php

(4) Install McCrypt: Pretty sure I skipped this the second time around. If I have to do another one of these fresh installs again, I’ll try better to update this list.

(5) Apache Mod_Rewrite: Lastly, I’m still struggling with getting Apache’s mod_rewrite to work correctly. That is, even though I have it installed and activated, my local WordPress sites don’t work unless I turn the permalinks off. Which is a bit of  a pain since I then have to remember to update those settings when I upload to the server.

(6) Database Backups: Unfortunately, I found out that my TimeMachine backups had already deleted the last full backup of my machine pre-wipe out by the time I realized that I’d forgotten to load in all my old databases. This meant that I lost all of the work that I’d only done locally and hadn’t yet uploaded to any dev/stage/production server. So note for the future: treat your local machine like a server and do mysqldumps that you can be easily backed up via your current backup routine and then easily loaded when needed.

Happy Instals.