- Install X-code Command Line Tools
- Install Homebrew
-
-
Save pascalduez/7948710 to your computer and use it in GitHub Desktop.
Mavericks ships with Apache version 2.2.24
$ httpd -v
Server version: Apache/2.2.24 (Unix)
Server built: Aug 24 2013 21:10:43
$ cd /private/etc/apache2
A backup can't hurt
$ sudo cp httpd.conf httpd.conf.backup
Move the virtual host config into a more handy place
$ sudo cp extra/httpd-vhosts.conf /your/path/httpd-vhosts.conf
In httpd.conf
Include /your/path/httpd-vhosts.conf
$ sudo apachectl start
$ open http://localhost
Mavericks ships with PHP version 5.4.17
$ php -v
PHP 5.4.17 (cli) (built: Aug 25 2013 02:03:38)
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2013 Zend Technologies
To use it right away, uncomment in httpd.conf
LoadModule php5_module libexec/apache2/libphp5.so
Or install a newer version
$ brew update
$ brew tap homebrew/dupes
$ brew tap josegonzalez/homebrew-php
Check the options
$ brew options php55
Install...
$ brew install php55
In httpd.conf
LoadModule php5_module /usr/local/opt/php55/libexec/apache2/libphp5.so
$ sudo apachectl restart
In .zshrc
export PATH="$(brew --prefix josegonzalez/php/php55)/bin:$PATH"
$ php -v
$ brew install mariadb
$ /usr/local/Cellar/mariadb/5.5.34/bin/mysql_install_db --verbose --user=whoami --basedir=/usr/local/Cellar/mariadb/5.5.34 --datadir=/usr/local/var
Or
$ mysql_install_db --user=mysql --basedir=$(brew --prefix mariadb)
Or
$ /usr/local/Cellar/mariadb/5.5.34/bin/mysql_secure_installation
For instance…
$ cp $(brew --prefix mariadb)/support-files/my-large.cnf $(brew --prefix)/etc/my.cnf.dmy-large.cnf
# Local AMP (Apache, MariaDB, PHP) dev environment
function amp() {
if [ "$1" = "start" ] || [ "$1" = "stop" ]; then
sudo apachectl "$1"
mysql.server "$1"
fi
if [ "$1" = "conf" ]; then
subl -n /private/etc/apache2/httpd.conf /usr/local/etc/php/5.5/php.ini /usr/local/etc/my.cnf
fi
if [ "$1" = "hosts" ]; then
subl -n /choose/your/path/httpd-vhosts.conf
fi
}
$ amp start | stop | conf