Fix MAMP: Apache won’t start but MySQL will
If your MAMP will start MySQL just fine but won’t start Apache there is likely 2 problems you’re facing.
- Port number conflict, or
- Apache related error that for some reason doesn’t show up in the MAMP apache logs.
How to Fix the port conflict in MAMP and Apache on Mac OS X
You need to disable web sharing. Web sharing intercepts communication going to port 80 which is the default port for websites and since MAMP is set to start by default on port 80 there is a conflict because Mac OS X Apache server already has the port reserved.
To enable or disable Web Sharing (Apache):
- From the Apple menu, choose System Preferences.
- From the View menu, choose Sharing.
- To enable Web Sharing, select the Web Sharing checkbox.
To disable Web Sharing, deselect the Web Sharing checkbox. - Close Sharing preferences.
How to fix the Apache not starting in MAMP problem
First you need to figure out what the problem is, but in my experience 9 times out of 10 it’s an apache config problem.
Open up a terminal and type change directories to wherever you installed MAMP, in my case it’s /Applications/MAMP/
crainbandy$ cd /Applications/MAMP/bin/
Once you’re in this directory you can call the shell script that typically starts the MAMP Apache server through the interface, type what’s below in your /MAMP Intall directory/MAMP/bin
crainbandy$ ./startApache.sh
Syntax error on line 368 of /Applications/MAMP/conf/apache/httpd.conf:
DocumentRoot must be a directory
Boom. It’s obvious what the problem is now. We need to modify our httpd.conf file to change the DocumentRoot to a folder that actually exists on our computer. This in my experience fixes the problem.
If you’re still having trouble post in the comments and we’ll see what we can do. The Apache error logs in MAMP are useless though because they don’t actually log the apache2 errors, if anyone knows where this log is please let me know, but I can’t find it.
