0

A few days ago my Apache server stopped 'starting'. Does anyone know about this problem.

I believe it is happening now because I, stupidly, moved a file called index.php into the htdocs/ folder.

I run lsof -i | grep LISTEN to get:

    mysqld    297 waltercarvalho   10u  IPv4 0xc942753e30142a85      0t0  TCP *:mysql (LISTEN)
    ubd       611 waltercarvalho   18u  IPv4 0xc942753e310c9f35      0t0  TCP *:49228 (LISTEN)
    ubd       611 waltercarvalho   19u  IPv6 0xc942753e2d7a5635      0t0  TCP *:49228 (LISTEN)
    Dropbox   720 waltercarvalho   18u  IPv4 0xc942753e310c90c5      0t0  TCP *:17500 (LISTEN)
    Dropbox   720 waltercarvalho   25u  IPv4 0xc942753e31c584dd      0t0  TCP localhost:26164 (LISTEN)

When I try to start the Apache server on port 80, in order to access localhost (the clean way), I get:

I run sudo /Applications/MAMP/bin/startApache.sh to get:

    (48)Address already in use: make_sock: could not bind to address [::]:80
    (48)Address already in use: make_sock: could not bind to address 0.0.0.0:80
    no listening sockets available, shutting down
    Unable to open logs

Which means port 80 is being used. You can find my httpd.conf file at:

http://pastebin.com/dta3hND8

I have been trying to fix this for a few hours now, extremely frustrating. I have tried everything.

Thank you.

Charles
  • 50,943
  • 13
  • 104
  • 142
waltfy
  • 137
  • 3
  • 16
  • 1
    do a `netstat -anp` if this is linux and see what process has port 80 bound. – Joe Jan 08 '13 at 23:50
  • @Joe MAMP == Mac, but suggestion remains valid AFAIK – fvu Jan 08 '13 at 23:51
  • Hi Joe, I am using OS X. As you can see the command `lsof -i | grep LISTEN` does something similar to `netstat -anp` the responsible processes are 611, they are hogging port 80. I run `kill 611` and it just restarts with a different Process ID. – waltfy Jan 08 '13 at 23:52
  • 1
    @waltercarvalho Have a look at http://stackoverflow.com/questions/3703751/how-do-i-find-out-how-macports-stole-my-port80 as it looks very similar. – fvu Jan 08 '13 at 23:54

1 Answers1

1

i've been struggling with this issue.. fairly certain it's dropbox that's interfering. i found a solution that works like a charm, albeit not a perm fix. i run the sequence fairly often. it's an annoyance, but at least these steps are clear, simple, and predictable! ..AND i get my 80/3306 back.

fix courtesy of Abhinav Sood.

  1. Launch MAMP. Open Terminal by typing terminal into Spotlight (Command + Space).

  2. Open MAMP Preferences (Command + , ) and click on Reset MAMP Ports (Port 8888 and Port 8889 for Apache and MySQL respectively). Click on OK.

  3. Switch to the terminal. Type sudo apachectl stop to shutdown the system Apache.

  4. Restart MAMP.

  5. Open MAMP Preferences once again and click on Set to Default Apache and MySQL ports. This will set the Apache and MySQL ports to 80 and 3306 respectively.

  6. Switch to the terminal. Type sudo apachectl restart to restart Apache.

  7. Switch back to MAMP and click on Open Start Page (or go to http://localhost/MAMP/?language=English in your browser)

And you’re done.

mazal
  • 71
  • 1
  • 5