How To Install Php, Mysql & Nginx On Mac Os X With Homebrew

Installing PHP, Mysql & Nginx on Mac OS X with Homebrew, step by step

We are all familiar with the Apache web-server, it is indeed a great HTTP server, but like many other piece of software out there, it has it's downside and performance wise it is not great for high traffic websites, unless you have an extremely powerful servers with a lot of resources to spare.

NGINX is a free open source HTTP web-server; It is very powerful and full of features and most importantly, it is a high performance web-server.

In this tutorial you will learn how to install NGINX web-server on you Mac OS X with the help of Homebrew.

Homebrew is a great package manager for Mac OS X and can be easily installed.

Installing Homebrew

You can install Homebrew with a single command if you don’t already have it.

ruby -e "$(curl -fsSL https://raw.github.com/mxcl/homebrew/go)"

Installing PHP 5.4 (with FPM)

You can search for available PHP formulas (In Homebrew formulas are equivalent to packages in aptitude)

brew search php

It will return a long list of php 5.2, 5.3, 5.4 packages. We need 5.4. Tap it using:

brew tap josegonzalez/php
brew tap homebrew/dupes

Note: If you do not tap homebrew/dupes you will get Error: No available formula for zlib.

You can also pass options like you do when compiling files under Linux, before you pass any parameter I suggest you look at your options with: