Install MAMP
Install MAMP by downloading it from the MAMP website and using their easy to follow instructions.
Use MAMP’s version of PHP and MySQL
You can use these default configurations but there are limitations.
To use the MAMP PHP and MySQL make an alias for each in your Bash Profile.
Open /Users/<user directory>/.bash_profile
for editing. If you don’t have a .bash_profile
file, create one.
To add an alias to the stack’s PHP bin
directory, add the following to the .bash_profile
file:
# Alias the path to the MAMP PHP interpreter. # Run 'phpmamp --help' to test. alias phpmamp='/Applications/MAMP/bin/php/php5.3.6/bin/php'
Save the .bash_profile
file. If Terminal is currently open, restart it so the alias will take effect, then test your results by using the alias. In terminal execute:
phpmamp --help
Now you can use the new phpmamp
alias in place of php
in your scripts.
Troubleshooting
Manually Start MAMP’s Apache server.
If Apache is failing to start from the MAMP UI window, start MAMP’s Apache manually on the command line to check error messages:
/Applications/MAMP/Library/bin/apachectl start
Manually stop MAMP’s Apache with:
/Applications/MAMP/Library/bin/apachectl stop
Yosemite OS
Per the Knowledge Base at MAMP for “Apache will not start – Yosemite Beta”:
Rename the file envvars located in /Applications/MAMP/Library/bin
to _envvars, and or comment-out the following lines from within the file like so:
#DYLD_LIBRARY_PATH="/Applications/MAMP/Library/lib:$DYLD_LIBRARY_PATH" #export DYLD_LIBRARY_PATH
MySQL Fails to Start
InnoDB: Unable to lock ./ibdata1
from error log at /Applications/MAMP/logs/mysql_error_log.err