OSX PHP Homebrew Setup

fork me on github

install php with mysql pgsql intl support

$ brew install php –with-apache –with-mysql –with-pgsql –with-intl

set php timezone in php ini

date.timezone = Europe/Vienna

load php module in apache

in /private/etc/apache2/httpd.conf add

LoadModule php5_module $FULLPATH/libphp5.so

fix pear permissions and config

$ chmod -R ug+w /usr/local/Cellar/php/5.3.10/lib/php
$ pear config-set php_ini /usr/local/etc/php.ini

install mysql default tables

$ unset TMPDIR
$ mysql_install_db –verbose –user=whoami –basedir=”$(brew –prefix mysql)” –datadir=/usr/local/var/mysql –tmpdir=/tmp

set mysql up to start automatically on system boot:

$ mkdir -p ~/Library/LaunchAgents
$ cp /usr/local/Cellar/mysql/5.5.10/com.mysql.mysqld.plist ~/Library/LaunchAgents/
$ launchctl load -w ~/Library/LaunchAgents/com.mysql.mysqld.plist

Start mysql:

$ mysql.server start

install xdebug & apc

if you don’t have autoconf (Xcode 4.3) install autoconf

$ brew install autoconf

$ pecl installxdebug apc

xdebug setup

and change

extension=xdebug.so

to

zend_extension=”$fullpath/xdebug.so”
xdebug.remote_enable = On
xdebug.remote_autostart = 1

install pear packages

php q/a tools

$ pear config-set auto_discover 1
$ pear install pear.phpqatools.org/phpqatools pear.netpirates.net/phpDox

this will install:

PHP_Depend, PHP_CodeSniffer, File_Iterator Text_Template, PHP_Timer, YAML, Console_CommandLine, Log, PHP_TokenStream, Base, PHP_PMD, PHP_CodeBrowser, PHP_CodeCoverage, PHPUnit_MockObject, ConsoleTools, PHPUnit, phpcpd, phploc, phpqatools

install phing

$ pear channel-discover pear.phing.info
$ pear config-set preferred_state beta
$ pear install phing/phing
$ pear config-set preferred_state stable

resources