Today I set out to get MySQL and PHP setup on my MacBook Pro. Since Apache2 already comes with MacOS X (mine is Snow Leopard and yours should be too!). Now, the funny thing is that I first searched on the web how to best install PHP and MySQL.
Surely, I came across MAMP (a package that gets you Apache2, PHP, MySQL and a couple libraries) in a nice one click application and some others. Being the guy who rather has things separated and controllable, I quickly shined away from those. Thought, I gave MAMP a try, but could not get MySQL to listen to anything else then the internal Apache2 server from the MAMP package (but guess that is another story and I’m really not doing this the first time.). Anyhow…
I then looked into getting Apache2, MySQL and PHP with MacPorts. Thought MacPorts has proven to be perfect in such circumstances, I had a hard time (and it took very long) to get this setup up and running. I’m sure, some of you have had successful installs and all works great, but at the end it did not work for me. There are even more instructions to get PHP running, with a lot of tweaking and such, but to be honest in the end…
Really the simplest and most straightforward method to get Apache2, MySQL and PHP running on MacOS X is;
Now, this is really no brainer. All you need to do is to go to http://www.mysql.com and download the recent release. Within the download image you will find a nice installer and Preference pane which lets you start/stop MySQL. If you want to go all GUI, then also download the GUI tools from MySQL.
The probably easiest of it all. Since MacOS X already comes with Apache2 and PHP all you need to do is to enable it. Thought, PHP is disabled in the httpd.conf, all there is to do is to edit httpd.conf and uncomment the mod for the php library.
Nothing to install, (almost) nothing to configure. Simple and easy.