XAMPP won't start Apache on Mac OS X 10.10.3 Yosemite

33,199

Solution 1

After months of trying, I finally got it working. I found the solution here: disable OSX's built-in Apache server.

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

Solution 2

You should check for other processes bound on a TCP socket to port 80.

netstat -atp tcp | grep -i "listen"

Achive Internet connections (including servers)
Proto Recv-Q Send-Q  Local Address          Foreign Address        (state)   
tcp4       0      0  localhost.25035        *.*                    LISTEN
sudo lsof -i -P | grep -i "listen"

COMMAND     PID      USER   FD   TYPE             DEVICE SIZE/OFF NODE NAME
GitHub      850 grgarside   6u   IPv4 0x23c345381d089301      0t0  TCP localhost:25035 (LISTEN)
Share:
33,199

Related videos on Youtube

physicalattraction
Author by

physicalattraction

I am the CTO of the startup company Fashion Cloud, developing software for fashion retail buyers. I have previous experience with Matlab, C# and C, but the current technology stack consists of the languages Swift, Python and JavaScript.

Updated on September 18, 2022

Comments

  • physicalattraction
    physicalattraction over 1 year

    I had a local XAMPP stack running on my Macbook Pro fine for weeks (OS X Yosemite 10.10.3, XAMPP 5.5.24). Then, I spent some time trying to install a library, in which I somehow messed up the installation of XAMPP. Now Apache does not start up at all anymore. This is what I tried.

    Start up Apache

    $ sudo /Applications/XAMPP/xamppfiles/xampp startapache
    XAMPP: Starting Apache...fail.
    XAMPP:  Another web server is already running.
    
    $ sudo /Applications/XAMPP/xamppfiles/xampp stopapache
    XAMPP: Stopping Apache...not running.
    

    So I try to find which web server is already running.

    Zombie apaches

    I check for zombie apaches.

    $ sudo lsof | grep AMP | grep apache
    $ ps -x | grep apache
     7980 ttys000    0:00.00 grep apache
    $ ps -x | grep AMP
     7990 ttys000    0:00.00 grep AMP
    

    So I don't see any webserver running.

    Skype

    I close Skype. Still the same problem.

    Other listeners on port 80

    I checked for other listeners on port 80, as suggested in mnfc's answer.

    $ lsof -i -P | grep -i "listen"
    SpotifyWe  267 erwin    6u  IPv4 0x45f774a11f61c26b      0t0  TCP localhost:4370 (LISTEN)
    SpotifyWe  267 erwin    7u  IPv4 0x45f774a11f61b99b      0t0  TCP localhost:4380 (LISTEN)
    Dropbox    281 erwin   26u  IPv4 0x45f774a11f5b926b      0t0  TCP localhost:17603 (LISTEN)
    Dropbox    281 erwin   27u  IPv4 0x45f774a12399b65b      0t0  TCP *:17500 (LISTEN)
    Dropbox    281 erwin   33u  IPv4 0x45f774a117b1665b      0t0  TCP localhost:17600 (LISTEN)
    
    $ netstat -atp tcp | grep -i "listen"
    tcp46      0      0  *.ftp                  *.*                    LISTEN     
    tcp46      0      0  *.mysql                *.*                    LISTEN     
    tcp4       0      0  localhost.17600        *.*                    LISTEN     
    tcp4       0      0  localhost.17603        *.*                    LISTEN     
    tcp4       0      0  *.17500                *.*                    LISTEN     
    tcp4       0      0  localhost.4380         *.*                    LISTEN     
    tcp4       0      0  localhost.4370         *.*                    LISTEN     
    tcp46      0      0  *.http                 *.*                    LISTEN     
    tcp4       0      0  localhost.ipp          *.*                    LISTEN     
    tcp6       0      0  localhost.ipp          *.*                    LISTEN     
    
    $ lsof -i :80
    COMMAND  PID  USER   FD   TYPE             DEVICE SIZE/OFF NODE NAME
    firefox 7929 erwin   41u  IPv4 0x45f774a12db287fb      0t0  TCP erwins-mbp.fritz.box:59555->ea-in-f113.1e100.net:http (ESTABLISHED)
    firefox 7929 erwin   48u  IPv4 0x45f774a134b4a65b      0t0  TCP erwins-mbp.fritz.box:59558->190.93.244.58:http (ESTABLISHED)
    firefox 7929 erwin   54u  IPv6 0x45f774a117aff4eb      0t0  TCP [2001:981:b88a:1:7467:5734:ba5f:58b8]:59565->ea-in-x65.1e100.net:http (ESTABLISHED)
    firefox 7929 erwin   56u  IPv4 0x45f774a11f61a7fb      0t0  TCP erwins-mbp.fritz.box:59574->ec2-23-21-247-182.compute-1.amazonaws.com:http (ESTABLISHED)
    firefox 7929 erwin   58u  IPv4 0x45f774a125dc499b      0t0  TCP erwins-mbp.fritz.box:59575->ec2-23-21-247-182.compute-1.amazonaws.com:http (ESTABLISHED)
    firefox 7929 erwin   59u  IPv4 0x45f774a12db2999b      0t0  TCP erwins-mbp.fritz.box:59566->104.16.13.8:http (ESTABLISHED)
    firefox 7929 erwin   60u  IPv4 0x45f774a134b5199b      0t0  TCP erwins-mbp.fritz.box:59569->ip-82-94-234-88.ams.byte.nl:http (ESTABLISHED)
    firefox 7929 erwin   63u  IPv4 0x45f774a12db6d7fb      0t0  TCP erwins-mbp.fritz.box:59576->93.184.220.29:http (ESTABLISHED)
    firefox 7929 erwin   65u  IPv4 0x45f774a13ae124bb      0t0  TCP erwins-mbp.fritz.box:59579->a23-52-59-27.deploy.static.akamaitechnologies.com:http (ESTABLISHED)
    firefox 7929 erwin   67u  IPv4 0x45f774a1275404bb      0t0  TCP erwins-mbp.fritz.box:59568->ip-82-94-234-88.ams.byte.nl:http (ESTABLISHED)
    firefox 7929 erwin   69u  IPv4 0x45f774a134b43b3b      0t0  TCP erwins-mbp.fritz.box:59581->server-54-230-130-235.ams50.r.cloudfront.net:http (ESTABLISHED)
    firefox 7929 erwin   70u  IPv4 0x45f774a12db69b3b      0t0  TCP erwins-mbp.fritz.box:59577->104.16.13.8:http (ESTABLISHED)
    

    As super user:

    $ sudo lsof -i -P | grep -i "listen"
    Password:
    launchd      1           root   26u  IPv6 0x45f774a117b02beb      0t0  TCP localhost:631 (LISTEN)
    launchd      1           root   34u  IPv4 0x45f774a117b19b3b      0t0  TCP localhost:631 (LISTEN)
    launchd      1           root   35u  IPv4 0x45f774a117b19b3b      0t0  TCP localhost:631 (LISTEN)
    launchd      1           root   45u  IPv6 0x45f774a117b02beb      0t0  TCP localhost:631 (LISTEN)
    httpd       74           root    4u  IPv6 0x45f774a117b026eb      0t0  TCP *:80 (LISTEN)
    SpotifyWe  267          erwin    6u  IPv4 0x45f774a11f61c26b      0t0  TCP localhost:4370 (LISTEN)
    SpotifyWe  267          erwin    7u  IPv4 0x45f774a11f61b99b      0t0  TCP localhost:4380 (LISTEN)
    Dropbox    281          erwin   26u  IPv4 0x45f774a11f5b926b      0t0  TCP localhost:17603 (LISTEN)
    Dropbox    281          erwin   27u  IPv4 0x45f774a12399b65b      0t0  TCP *:17500 (LISTEN)
    Dropbox    281          erwin   33u  IPv4 0x45f774a117b1665b      0t0  TCP localhost:17600 (LISTEN)
    httpd      311           _www    4u  IPv6 0x45f774a117b026eb      0t0  TCP *:80 (LISTEN)
    httpd     1227           _www    4u  IPv6 0x45f774a117b026eb      0t0  TCP *:80 (LISTEN)
    mysqld    1832         _mysql   24u  IPv6 0x45f774a117b00deb      0t0  TCP *:3306 (LISTEN)
    proftpd   1911         daemon    0u  IPv6 0x45f774a117afe5eb      0t0  TCP *:21 (LISTEN)
    
    Erwins-MBP:~ erwin$ sudo lsof -i :80
    COMMAND  PID  USER   FD   TYPE             DEVICE SIZE/OFF NODE NAME
    httpd     74  root    4u  IPv6 0x45f774a117b026eb      0t0  TCP *:http (LISTEN)
    httpd    311  _www    4u  IPv6 0x45f774a117b026eb      0t0  TCP *:http (LISTEN)
    httpd   1227  _www    4u  IPv6 0x45f774a117b026eb      0t0  TCP *:http (LISTEN)
    firefox 8014 erwin   68u  IPv4 0x45f774a1462ac7fb      0t0  TCP erwins-mbp.fritz.box:64603->ee-in-f113.1e100.net:http (ESTABLISHED)
    firefox 8014 erwin   74u  IPv4 0x45f774a12db290cb      0t0  TCP erwins-mbp.fritz.box:64598->190.93.246.58:http (ESTABLISHED)
    firefox 8014 erwin   82u  IPv4 0x45f774a12db5399b      0t0  TCP erwins-mbp.fritz.box:64605->ip-82-94-234-98.ams.byte.nl:http (ESTABLISHED)
    

    Kill other listeners on port 80

    I wanted to kill the existing httpd processes. I first closed all other applications, including Firefox. When I try to kill them using sudo killall httpd or sudo kill 1227, they don't disappear. I still cannot start my Apache server then.

    Complete fresh installation

    I uninstalled XAMPP completely, removed the directory, and reinstalled XAMPP from the installation package. I rebooted my Macbook. Still the same problem.

    XAMPP Manager OS X

    • Romeo Ninov
      Romeo Ninov about 9 years
      What is inside apache logs?
    • physicalattraction
      physicalattraction about 9 years
      Where can I find these logs? If they are the files in /Applications/XAMPP/logs, they are all empty.
  • Fazer87
    Fazer87 about 9 years
    While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes.
  • Fazer87
    Fazer87 about 9 years
    Spot on. The reason we ask that you include relevant information is that the Apple SO page you linked to could be deleted, changed, spammed/deformed.. which would not only kill that answer, but yours too. Also, you now get recognition for making effort insteaf of just being smart enough to copy/paste :)
  • mnfc12
    mnfc12 about 9 years
    You mean i now get recognition because i actually did copy/paste :D sorry for OT though
  • physicalattraction
    physicalattraction about 9 years
    Thanks for the answer. I indeed had checked that already, but forgot to mention that in my post. I have added it now. Unfortunately, that did not give me any clue for a process that is blocking my Apache server. :-(
  • Romeo Ninov
    Romeo Ninov about 9 years
    There is something, which listen. See line: tcp46 0 0 .http *. LISTEN
  • mnfc12
    mnfc12 about 9 years
    It's as Romeo Ninov said. Now find out which process is listening: lsof -i -P | grep -i "listen"
  • physicalattraction
    physicalattraction about 9 years
    I find it hard to understand the output of lsof, see my original post. Should I look at this line: Dropbox 281 erwin 27u IPv4 0x45f774a12399b65b 0t0 TCP *:17500 (LISTEN)?
  • mnfc12
    mnfc12 about 9 years
    that's not the line we're looking for. What's the output of this: lsof -i :80
  • physicalattraction
    physicalattraction about 9 years
    I have added the output in the OP. Again, I don't really understand the output of that command.
  • mnfc12
    mnfc12 about 9 years
    The important part we were looking for is in columns 6, 7, 8 (TCP *:80 LISTEN). If we found a match we could identify the process by its PID/command. According to your netstat output there's already a process listening on TCP port 80 (http). tcp46 0 0 *.http *.* LISTEN Since we didn't find the process we were looking for in that output, i guess the process does not belong to your user. Try running it as root. sudo lsof -i -P | grep -i "listen" The output i'm expecting should look like this root 12u IPv4 0x45f774a12399b65b 0t0 TCP *:80 (LISTEN)
  • physicalattraction
    physicalattraction about 9 years
    First of all: @mnfc12, thanks for your trouble! Really appreciate it. I indeed find now a listener: httpd. I have added the output in the OP. This seems to be the exact web server that I am trying to start up! How could this process still be running, even after I completely removed XAMPP and restarted my computer?
  • mnfc12
    mnfc12 about 9 years
    This must be another httpd executable that's launched on startup. At this point I'm not sure how to track down the program on Mac OS since I use Linux. How do I get the full path... If you know its location you, you might be able to find out when/why you've installed it on your machine. However you can also just skip this part, kill the process by its id and start xampp. This is no clean solution but since you should only use XAMPP for testing anyway, it could be sufficient.
  • physicalattraction
    physicalattraction almost 9 years
    I tried to kill the processes, but they come back by itself. I still cannot start the Apache webserver.
  • Kinnectus
    Kinnectus almost 9 years
    Have a look in System Preferences anything related to Web Sharing... disable this and it may stop the httpd service that keeps respawning
  • physicalattraction
    physicalattraction almost 9 years
    I don't find web sharing, I do find internet sharing. That is already disabled, like all other sharing options.
  • bertieb
    bertieb about 7 years
    This is a tangential answer to OP's question, which was about Apache not starting. I would also be surprised if ftpdctl started Apache...
  • André Perazzi
    André Perazzi about 6 years
    Man, you're the best