PHP and apache are included on Mac OSX but there are a few things you need to set it up. This setup is also needed after upgrading to Yosemite, for some reason the update removed all these config settings.


  • edit httpd.conf
$ sudo vim /etc/apache2/httpd.conf
  • update DocumentRoot and add a Directory Block for your Dev

DocumentRoot “/Users/[username]/Dev”

<Directory "/Users/[username]/Dev">
DirectoryIndex index.html index.htm index.php
Options FollowSymLinks Multiviews Indexes
MultiviewsMatch Any
AllowOverride All
Require all granted

Uncomment some modules

LoadModule rewrite_module libexec/apache2/
LoadModule php5_module libexec/apache2/
  • save httpd.conf

  • copy php.ini

$ sudo cp /etc/php.ini.default /etc/php.ini
  • change permissions and edit php.ini
$ sudo chmod 755 /etc/php.ini
$ sudo vim /etc/php.ini
  • change errors and open tags
    display_errors = On
    short_open_tags = On

  • save php.ini

  • restart apache

$ sudo apachectl graceful
  • verify apache is running


$ curl -O 
$ sudo php -d detect_unicode=0 go-pear.phar 
# option 1
$ /usr/local/pear
# option 4
$ /usr/local/bin

See more at:

  • may need
$ brew install automake
  • install mongo

If you are running El-Capitan you will need to run csrutil disable from the recovery terminal before running pecl install.

$ sudo pecl install mongo

# if you get php.h not found install xcode command line tools
$ xcode-select --install

# if you get an error about autoconf
$ brew install autoconf
  • add to php.ini under Dynamic extensions

  • restart apache

$ sudo apachectl graceful
  • install mongodb
$ brew install mongo
  • Update Apache Bench
$ curl -O

$ brew install pcre

$ sudo ln -s /Applications/ /Applications/

$ tar xzvf httpd-2.4.2.tar.gz
$ cd httpd-2.4.2/
$ ./configure
$ make

$ sudo cp support/ab /usr/sbin