Install Apache 2, PHP 5.3, and MySQL 5 with MacPorts, Revisited
Install and configure MySQL 5 with MacPorts
7/18/09 - Having trouble starting MySQL on system startup? Rob Wilkerson shows how he gets around the issue.
4/2/08 - UPDATED - Replaced symlink to MySQL socket with proper MySQL configuration file settings. Thanks Doug!
10/20/07 - UPDATED - Added full path to aliases, thanks Joel!
10/7/07 - UPDATED - Clarified +server option and executable names, thanks Thom!
I decided to move my MySQL server installation from the server I installed from MySQL.com to macports. Why? I believe MacPorts will simplify future upgrades. I'd also like to keep my LAMP installs in the same location. If you haven't already, install and configure MacPorts. Here are the steps I'll go over:
- Intall MySQL 5
- Create the initial MySQL databases
- Options for starting MySQL
- Confirm that MySQL is running
- Set Basic MySQL Security
Install Apache 2 and PHP 5 with MacPorts
4/2/08 - Added php.ini settings to use the proper MySQL socket at /tmp/mysql.sock.
3/23/08 - After going through these instructions on a new Leopard system, I made a few minor updates. The steps should now work for Leopard as well as Tiger.
While options abound, MacPorts may be the easiest option to configure a local web development environment on your Mac. I'll mention a few of the other options and then share the steps I've used to install Apache 2 and PHP 5 with MacPorts.
Easily Manage Unix Packages on the Mac with MacPorts, formerly DarwinPorts
I compiled the latest version of PHP this week at work. It took longer than I expected and dealing with the myriad of package dependencies required to add support for XML/XSLT, GD, and Sybase/MS SQL Server was a PITA. While I know that *nix server administrators must be able to compile software from source, I wouldn't want to make it a regular practice. Just like Linux distributions, Unix package managers exist for Mac OS X. There are two package managers available for the Mac: MacPorts and Fink. Although Fink appears to have a much larger user base, MacPorts is more closely tied to Apple's open source community. In this post I'll go over how you can use MacPorts to manage Unix libraries, modules for languages including Perl and Python, and open source applications, including Wordpress, MediaWiki, and Gallery.