# Local dev. setup by using homebrew
Note:An quick, stort and easy starting point. Does not provide any background information outside the needed steps getting PHP, Apache and the database server running.
Tested on OS X 10.8.x/10.9.x.
* Install XCode from Apple App store and xcode command line tools from https://developer.apple.com/xcode.
* X11 (http://xquartz.macosforge.org)
* Install howebrew (http://brew.sh) by following the documentation found on the page.
## How to install PHP
Nothing is stopping you from having different PHP installations at the same time. PHP 5.5/5.3 is installed the same way as PHP 5.4 by simply replacing php54 with php55/php53.
brew tap homebrew/dupes
brew tap homebrew/php
### Install PHP 5.4 with PostgreSQL and Mariadb support
brew install php54 --with-pgsql
### Any extra module you need. Examples
brew install php54-apc
brew install php54-uploadprogress
Any problems try installing upload progress with:
brew install --with-homebrew-php php54-uploadprogress).
### Install usefull PHP debugging tools
brew install php54-xhprof
brew install php54-xdebug
Find other build options by running
'brew options php54'
PHP from homebrew also introduce seperate php.ini file. You will find them in '/usr/local/etc/php/
### Config php.ini
Make sure your timezone is set up correct.
/usr/local/etc/php/5.4/php.ini
date.timezone = Europe/Oslo
### Set up your shell.
Make sure that your shell is using PHP provided by homebrew. Add this to your ~/.bash_profile.
export PATH="$(brew --prefix homebrew/php/php55)/bin:$PATH"
verify that this is working by running
source ~/.bash_profile php -v
## Configure Apache
OS X stock Apache config file is found at '/private/etc/apache2/httpd.conf' and you need to tell apache to use the new homebrew PHP module instead to the system default one.
Uncomment line:
'LoadModule php5_module libexec/apache2/libphp5.so'
Inclue something along these lines:
LoadModule php5_module /usr/local/opt/php54/libexec/apache2/libphp5.so
## Install PostgreSQL server
* brew install postgres
Initialize the postgresql data storage area (directory).
initdb /usr/local/var/postgres
Start the postgres server:
postgres -D /usr/local/var/postgres
or start with postgres utility pg_ctl:
pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start
Create your users and db by using, createdb and createuser.
To stop the server: 'pg_ctl -D /usr/local/var/postgres stop'
If the server is having problem stoping, try: 'pg_ctl -D /usr/local/var/postgres stop -m fast'
Find more by running 'brew info postgresql'.
### Optional tap/keg
* brew tap petere/postgresql
* brew install postgresql-9.3
To use this PostgreSQL installation, do one or more of the following:
- Call all programs explicitly with /usr/local/opt/postgresql-9.3/bin/...
- Add /usr/local/opt/postgresql-9.3/bin to your PATH
- brew link -f postgresql-9.3
- Install the postgresql-common package
This formula is keg-only: so it was not symlinked into /usr/local.
### Install postgresql-common
* brew install --HEAD postgresql-common
## Install MariaDB
Note: Building on OSX 10.9 will req. you to install gcc-42 first.
brew install apple-gcc42
* brew install mariadb
* Init db
unset TMPDIR mysql_install_db
Start db server with: 'mysql.server start'
or if problems try using: 'mysqld_safe --datadir=/usr/local/var/mysql'
Configure your admin user and password: 'mysqladmin -u root password 'new-password''