1

When I try starting Apache from the XAMPP control panel (Mac OS X 10.6.8 Snow Leopard), I get the following error popup and Apache won’t start:

/Applications/XAMPP/xamppfiles/bin/apachectl: line 70: ulimit: open files: cannot modify limit: Invalid argument
(48)Address already in use: make_sock: could not bind to address [::]:80

XAMPP was running perfectly 10 minutes earlier. I stopped Apache to add some .conf files and it failed on restart. I removed all the new .conf files (i.e. reverted it to how it was before) but now I get the above message.

I’ve checked AppMonitor and I see the httpd processes (one by _www nested within root). Just tried quitting these but they’re auto-restarted on new process IDs and it didn’t solve the problem.

And I’ve tried a full reboot and I still get the same error (before starting any apps). I’d be grateful if someone has an idea how to solve this.

0

3 Answers 3

0

It's complaining about port 80 already being in use. In scenarios like yours, this is commonly caused by Apache already (or still) running.

As you already noticed, there is still an httpd process running. Make sure to first exit all Apache HTTPD processes and then start it again.

5
  • Thanks for clarifying what the key issue is. How can I be sure all HTTPD processes have been exited (or killed)? Apr 23, 2012 at 12:19
  • Usually, they should properly exit when Apache is stopped (for example by using apachectl). If due to some error, that didn't happen. You can always force them to shut down by using something like sudo killall httpd or sudo killall apache2. Apr 23, 2012 at 12:26
  • I tried sudo killall httpd and it killed the process but then recreated it, just as it did when I clicked Quit Process in App Monitor. The httpd process owned by _www is nested within an httpd process owned by root, which in turn is nested within the launchd process owned by root. Perhaps launchd is restarting it each time? Apr 23, 2012 at 16:13
  • Also stop using Skype. Skype uses port 80
    – J Bourne
    Jun 19, 2014 at 8:22
  • @Sai Not when you disable it. i.imgur.com/nkJdUy9.png Jun 19, 2014 at 9:40
0

This will permentaly disable httpd.

sudo launchctl unload -w /System/Library/LaunchDaemon/org.apache.httpd.plist
0

There are two things that could be causing the issue: Apple’s built in web sharing service being active or zombie XAMPP processes still being active.

If this is caused by Apple’s web sharing you can handle this all by going to System Preferences… and then selecting Sharing. Once there, uncheck Web Sharing—which is basically just Apache httpd—and your problem should be solved.

That said, if this is basically a “zombie” instance of Apache running after some XAMPP tweaks, the best bet is to do something like the following:

First, run lsof (list open files) which will list all of the files actively open on the system.

sudo lsof | grep MAMP | grep apache

Note the two grep commands piped together? What I am doing is getting the list of open files, then filtering those which have a file path connected to MAMP—or in your case change that to XAMPP or whatever folder/directory you have it running in—and the I am filtering the apache in the pathname. The list should look something like this:

httpd     2204            jake    2w      REG                1,2     24685 17953784 /Applications/MAMP/logs/apache_error.log
httpd     2211            jake    2w      REG                1,2     24685 17953784 /Applications/MAMP/logs/apache_error.log
httpd     2212            jake    2w      REG                1,2     24685 17953784 /Applications/MAMP/logs/apache_error.log
httpd     2213            jake    2w      REG                1,2     24685 17953784 /Applications/MAMP/logs/apache_error.log
httpd     2214            jake    2w      REG                1,2     24685 17953784 /Applications/MAMP/logs/apache_error.log
httpd     2215            jake    2w      REG                1,2     24685 17953784 /Applications/MAMP/logs/apache_error.log
httpd     2216            jake    2w      REG                1,2     24685 17953784 /Applications/MAMP/logs/apache_error.log

Okay, that is a whole list of processes. Apache runs on the concept of there being one parent process with many child processes spawned to deal with traffic. So if you kill a child process, the parent process notices it & respawns a new child.

Now looking at that list, typically the lowest number in that process list will be the parent—since it starts up before the other child process of course—so you should kill that to kill all processes. So in this case, the lowest number process in the list is 2204, so just run this command:

kill 2204

And then the parent process is killed and all child processes should drop away as well. Then port 80 should be available again.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .