2 Steps for setting up PHP, nginx and MySQL on OS X

Setting up your software development environment can be painful but there are lot of awesome tools out there to make our life easier. In this post I'll guide you through your PHP development environment setup with Nginx and Mysql with couple of easy steps. No Apache, Sorry.

#1 Get Homebrew <3

Homebrew is a package manger of OS X just like apt, rpm, yum for GNU/Linux based OS. There are also other package manager for OS X like Macports is available but trust me, Homebrew is supercool.

To install, (If you haven't already) open up your terminal and :

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

then run:

brew doctor

#2 Run BEMP

BEMP is an one step easy installation script to install Nginx, MySQL and PHP via Homebrew.


curl -L https://raw.githubusercontent.com/thesabbir/bemp/master/install.sh | bash

You are done! Just open up your browser and visit http://localhost

  • For phpinfo() go to http://localhost/phpinfo.php

  • /var/www/ is where you put your documents.

  • /usr/local/etc/nginx/sites-available & usr/local/etc/nginx/sites-enabled is where you active and configure you virtual hosts.

  • /usr/local/etc/nginx/conf.d/php-fpm.conf is where your nginx configs for php-fpm.

  • /usr/local/etc/nginx/nginx.conf is your main nginx config file.

Having any trouble? Just leave a comment bellow or tweet @alreadySabbir.