Skip to content

Instantly share code, notes, and snippets.

@seanbehan
Forked from niepi/osx_php_homebrew.setup.md
Created November 21, 2013 15:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save seanbehan/7583828 to your computer and use it in GitHub Desktop.
Save seanbehan/7583828 to your computer and use it in GitHub Desktop.

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

$ brew install mysql

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 postgresql

$ brew install postgresql

initialize the DB

initdb /usr/local/var/postgres

add startup items

cp /usr/local/Cellar/postgresql/9.0.1/org.postgresql.postgres.plist ~/Library/LaunchAgents
launchctl load -w ~/Library/LaunchAgents/org.postgresql.postgres.plist

start Postgres

pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment