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

17 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????

  7. dale  on September 16th, 2010

    Perfect, exactly the info I needed. Now off to the races!

  8. oluwaseun  on September 27th, 2010

    Thanks a lot. Solved the problem.

    Cool

  9. Seb  on October 22nd, 2010

    I believe that I’ve got a bad user severin.
    I ran your command line on the correct file and got:

    httpd: bad user name severin

    I got smart and tried changing my username (as well as my password) to something other than ‘root’. I re-installed and hope. Any idea where I could go and jolt apache’s config to use the right username – which I’ve now reverted to root.

    ta

  10. vig0  on October 27th, 2010

    this was a huge help. Thanks for posting! I had forgot that I had ‘Web Sharing’ checked off in the system preferences.

  11. londonthelost  on November 4th, 2010

    after typing the second portion
    “/startApache.sh
    Syntax error on line 368 of /Applications/MAMP/conf/apache/httpd.conf:
    DocumentRoot must be a directory”

    I just keep receiving the notice “command not found”.
    Am I doing something wrong?

  12. prince  on November 27th, 2010

    I keep getting this error on MAMP and my apache server does not start.

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

  13. rk76  on January 15th, 2011

    I get the same error:

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

    What to do?

  14. kombismoke  on February 2nd, 2011

    For those who are 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

    The problem is you have a user account (home folder) that is more than one word. EXAMPLE: “this user” instead of the correctly formatted “thisuser”.

    The solution is to rename your user account so that it contains no spaces as detailed in the following official support document from Apple:

    http://support.apple.com/kb/ht1428

    hope this helps.

  15. brad  on February 18th, 2011

    I LOVE YOU

  16. Qark  on March 19th, 2011

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

    It was my user name. It was ‘Mac Pro 1′ and I changed it to my computers user name… which is my first name. and it worked….

  17. amitsamtani  on March 22nd, 2011

    Thanks for the tip on checking the Document Root. Worked!


Leave a Reply