-
Install Homebrew:
- Follow the install instructions found on this page.
-
Tap the wonderful homebrew-php from https://github.com/Homebrew/homebrew-php
$ brew tap homebrew-php
-
Install php with apache and mariadb
$ brew install mariadb $ brew install php55
-
Add the following to
/etc/apache2/httpd.conf
LoadModule php5_module /usr/local/opt/php55/libexec/apache2/libphp5.so
-
Apache 2.4 in OS X Yosemite does not enable
mod_rewrite
by default. Feel free to enable it if needed. -
Set the Apache user and group directives to your user shortname and the
staff
group. Do this in the file/etc/apache2/httpd.conf
- Restart Apache
- This allows Apache to host sites in folders other than
~/Sites
-
Make sure Apache and MariaDB are not accessible outside of your Mac
-
MariaDB
-
Pick a cnf file from
/usr/local/Cellar/mariadb//<current-version#>/support-files
and copy it to/usr/local/etc/my.cnf.d/
-
I used
my-medium.cnf
-
Edit the
my.cnf
file in the [mysqld] settings area: -
Comment out:
``` #binary logging is required for replication #log-bin=mysql-bin #binary logging format - mixed recommended #binlog_format=mixed #bind-address=127.0.0.1 ```
-
-
For enhanced security, you can remove the above and add the following to
my.cnf
in the[mysqld]
settings area. This prevents any TCP/IP connections to MariaDB. This changes will require your applications support database socket connections.skip-networking
-
Issue the following command and follow the setup instructions to your liking. You will should get prompted by the system firewall to allow or deny mysqld connections when you first start MariaDB. Deny access!
$ brew info mariadb
-
Once you have it setup, issue this commend to start the server manually:
$ mysql.server start
-
Apache
- Make sure that new vhosts only listen to
127.0.0.1
. Same goes for any port. - Block all incoming connections to
/usr/sbin/httpd
using the OS X Firewall settings in System Preferences
- Make sure that new vhosts only listen to
-
Helpful bit for your .zshrc to include homebew-php binaries to the system path
PATH="$(brew --prefix homebrew/php/php55)/bin:$PATH"
-
For large databases, you may need to incrase the
max_allowed_packet
size inmy.cnf
to something like the example below:max_allowed_packet=1024M
- http://clickontyler.com/virtualhostx/
- Great Mac app for maintaining Apache vhosts and /etc/hosts entries. Of course, you can do this yourself.
Looks good @shrop! I'd recommend changing the tap named
homebrew/homebrew-php
to justhomebrew/php
.