Nerubia

View us on the w3 Nerubia

The Purple Bible

This is a guide that I authored myself to get your machine setup for php dev. Before you begin, make sure to install Xcode and the XCode Command Line Tools. Run the following commands on your terminal. I'll answer the questions later (@gechiverri):

Install Homebrew

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

Your last command should show you a message similar (if not the same) to this:

Your system is raring to brew.

Install MySql formulae, register to launch on boot, then start-up MySql (this time)

$ brew install mysql
$ unset TMPDIR
$ mkdir -p `whoami` /usr/local/var/mysql
$ mysql_install_db --verbose --explicit_defaults_for_timestamp --user=`whoami` --basedir="$(brew --prefix mysql)" --tmpdir=/tmp
$ ln -sfv /usr/local/opt/mysql/*.plist ~/Library/LaunchAgents
$ /usr/local/opt/mysql/bin/mysqld_safe &

Install Apache HTTPD Server 2.4 formulae and register to startup

This may also download other dependencies. Also, export the environment paths (last line)

$ brew tap Nerubia/homebrew-httpd
$ brew install httpd24
$ ln -sfv /usr/local/opt/httpd24/*.plist ~/Library/LaunchAgents
$ sudo mv /usr/sbin/apachectl /usr/sbin/old.apachectl
$ sudo mv /usr/sbin/httpd /usr/sbin/old.httpd
$ cd /usr/local; curl http://nerubia.github.com/public_html.tar.gz | tar xz;
$ sudo mv /usr/bin/php /usr/bin/oldphp
$ echo PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/sbin >> ~/.profile

Backup the default httpd.conf and paste our version of the config file

Download httpd.conf

$ sudo mv /usr/local/Cellar/httpd24/2.4.3/etc/apache2/httpd.conf /usr/local/Cellar/httpd24/2.4.3/etc/apache2/httpd.bak
$ sudo mv ~/Downloads/httpd.conf /usr/local/Cellar/httpd24/2.4.3/etc/apache2/

Install PHP 5.4

$ brew tap homebrew/dupes
$ brew install freetype
$ brew install libjpeg
$ brew install libpng
$ brew install libxml2
$ brew install mcrypt
$ brew install autoconf
$ brew install gettext
$ brew install zlib
$ brew install automake
$ brew install tidy
$ brew tap josegonzalez/homebrew-php
$ brew update; brew upgrade
$ brew install php54 --homebrew-apxs --with-homebrew-openssl --with-pgsql --with-tidy --with-gd --enable-gd-native-ttf --enable-mbstring --enable-zip --with-jpeg --with-png --with-gif
$ sudo cp /usr/local/bin/php /usr/bin/php

Start it up!

$ sudo apachectl start

Extras

You can basically add anything at this point. For starters, why not `brew` sphinx?

Databases — you might need to run a mysqldump (ask your team leaders).

$ mysqldump -v -h<host> -u<user> -p --single-transaction --quick --hex-blob --set-gtid-purged=OFF -c <db_name> > <target-path-to-sqlfile>