Categories
Mac MySQL PHP

Mac OS X Lion: Homebrew, PHP54, MySQL and PEAR

In one of my old posts, I noted short documentation on how to get started with the AMP stack on Mac OS X Lion. In that setup, I was using the default PHP and downloaded MySQL from the mysql website. In this post, I am going to describe how I used homebrew to setup my AMP environment with ease!

The Homebrew Magic
Homebrew is a cool tool for Mac OS users. Written in Ruby, this beautiful tool works as a package manager for Mac OS. Unlike Mac Ports or Fink, homebrew takes less space, uses the default os x tools to compile everything to a custom location. This makes life suck less and clutter free!

To install PHP 5.4 branch using homebrew, just issue this command:

PS: If you want to customize the installation (like installing the mysql module by default) add necessary configuration options. Using the “bash-completion” formula from brew, you can hit tabs to see available installation options.

To view information on your PHP 5.4 installation via brew, type in:

Seperate MySQL Installation: Where is the ctl?
I have installed MySQL separately. I added the mysql and mysqldmin to my bash_profile like this:

And to start/stop/restart mysql server, I added:

That allows me to do:

Using PEAR
Homebrew installs all the PEAR packages to “/usr/local/Cellar/php54/5.4.3/lib/php”. So, I added it to my php include_path.

For PEAR to work correctly, we need sudo. If there are tools involved in the pear setup which can be run from command line (eg. phpunit), the binary files are stored in: “/usr/local/Cellar/php54/5.4.3/bin”.

I added the above path to my .bash_profile for convenience 🙂

5 replies on “Mac OS X Lion: Homebrew, PHP54, MySQL and PEAR”

My mysql.server points to the mysql installation via brew. I am using the MySQL I manually installed. That’s why I had to export it.

Comments are closed.