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.

  1. Port number conflict, or
  2. 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):

  1. From the Apple menu, choose System Preferences.
  2. From the View menu, choose Sharing.
  3. To enable Web Sharing, select the Web Sharing checkbox.
    To disable Web Sharing, deselect the Web Sharing checkbox.
  4. Close Sharing preferences.
If you’ve disabled web sharing and it’s still not working, try changing your Apache port to something like 8888 or 8889, these usually work for me. If this still doesn’t solve your problem then you’re most likely dealing with problem #2

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.

Related reading

  • No Related Post

6 Responses to “Fix MAMP: Apache won’t start but MySQL will”

  1. mmowery@hyperspider.com  on April 23rd, 2010

    Thanks for the tip on the port conflict.

  2. bryan  on April 26th, 2010

    No problem!

  3. guavajoel  on May 26th, 2010

    I am getting this error:

    “Syntax error on line 326 of /Applications/MAMP/conf/apache/httpd.conf:
    User takes one argument, Effective user id for this server”

    I am not sure what I should do.

  4. jpbanks  on May 27th, 2010

    It gives me
    “bad user name Rodrigo”

  5. maui  on June 14th, 2010

    hello there!..

    I am looking forward to enable external web sharing using MAMP.
    I have running on my snow Leo’s macbook an apache2 service installed with MAMP on port 80, and I’ve disabled webSharing on system properties.
    Also I configure some virtual servers on apache, tenis.local for example.

    The problem is when I try to access to my webservice from another machine on my LAN.
    Using http://192.16.1.x/ (my lan ip) I get my default homepage.
    But when I try http://tenis.loca/ from outside, I get no answer.
    Obviously, I already setup the hosts on the client machine pointing tenis.local to my LAN IP.

    Tks on advance, maui

  6. jessnuss  on August 1st, 2010

    I tried your suggestion and it resulted in the following error:

    Syntax error on line 326 of /Applications/MAMP/conf/apache/httpd.conf:
    User takes one argument, Effective user id for this server

    What does this mean????


Leave a Reply