Builds a LAMP (MAMP) stack on OS X 10.11 El Capitan using MacPorts.
Intended to be used on a fresh 10.11 install.
Please read this README all the way through before beginning.
MacPorts is powerful but finicky. I commonly end up with MySQL (I know, we're all switching to MariaDB soon) with the wrong permissions and other little niggling trouble. Therefore this script, which will reliably install MySQL 5.5 and PHP 5.6 plus Apache 2.2 on OS X. At least, for me. Tested with MacPorts 2.3.5 on OS X 10.11.
Install MacPorts with its prerequisites.
Make sure to install XCode and do
sudo xcodebuild -license xcode-select --install
Create a my.cnf and put it at /etc/my.cnf. You could use the Percona Wizard.
Ensure that /etc/my.cnf has a line for the socket MacPorts will use:
socket = /opt/local/var/run/mysql55/mysqld.sock
Read Through the Script
Note that it will set your MySQL root password to "password" unless you change this in the expect heredoc (ca. lines 36, 39).
Default Virtual Host
The script will create the following virtual host which can be reached by going to http://local.dev/ after the script completes.
NameVirtualHost *:80 <VirtualHost *:80> ServerName local.dev DocumentRoot /Users/username/Sites <Directory /Users/username/Sites> Options Indexes FollowSymLinks DirectoryIndex index.php index.html Order deny,allow Allow from 127.0.0.1 AllowOverride All </Directory> </VirtualHost>
The following functions will be installed in ~/.profile. I find them useful at the command line:
te - tail Apache error log ta - tail Apache access log tp - tail PHP error log acr - apachectl restart
Running the Scripts
sudo ./build_lamp sudo ./build_mysql
The install_drush script is now a historical footnote and should not be used.