71

I install XAMPP server on MAC OS 10.6 it was working fine. After a lot of days I checked it, but not working this time, localhost not opening this time.

after some R&D I reinstall XAMPP server after uninstall

When I start the apache after reinstall it giving port 80 running a another webserver Then I restart system, then apache start ok, but same local host not working

Then I check Web Sharing in my System Preference then it was already Tuned Off ...

Please anybody tell me where I am wrong?

2
  • This error occur while starting apache server............ Another webserver is already running!............... XAMPP's Apache can not start while another webserver is using port 80. Please turn it off and try again. Commented Jan 3, 2011 at 7:52
  • working with 127.0.0.1 but not with localhost....... even after the setting it into /Developer/usr/etc/distcc/hosts file...... 127.0.0.1 localhost Commented Jan 3, 2011 at 10:34

17 Answers 17

232

This is what helped me:

sudo apachectl stop

This command killed Apache server that was pre-installed on MAC OS X.

0
65

I had to disable OSX's built-in Apache server (XAMPP support thread):

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

This allowed XAMPP to start on 80, while POW runs on 20559.

What had failed: I reconfigured /etc/apache2/httpd.conf to listen on an alternate port and rebooted OSX. No luck.

5
  • Also, sometimes rebooting OSX prevents XAMPP from starting on 80 even though Web Sharing says it's off. Solution is to toggle Web Sharing on then off again, then XAMPP will start.
    – Steve Clay
    Commented Sep 23, 2012 at 20:21
  • This solution worked for me. But I am unsure what this did. and how can I enable the default apache incase I need to? Thanks.
    – pal4life
    Commented Nov 9, 2012 at 19:20
  • Going on 10 years later and this solution still worked for me.
    – Addy
    Commented Oct 18, 2019 at 14:07
  • Works like a charm on m1 macs
    – konnovdev
    Commented Dec 18, 2022 at 4:42
  • Nope. Trying to stop or disable apache just gives /System/Library/LaunchDaemons/org.apache.httpd.plist: Could not find specified service and XAMPP apache still doesn't start. Boy, it would be nice if somewhere on the internet there working instructions to get apache, php, mysql, and phpmyadmin running on a mac. This is a lot of nights up until 6AM getting absolutely nothing done except leaving whiny comments on a million SO posts that propose answers that don't do a thing.
    – John Smith
    Commented Nov 6, 2023 at 10:18
59

try

sudo /Applications/XAMPP/xamppfiles/bin/apachectl start

in terminal

1
  • This is what worked for me after changing listening port failed me. Thanks Commented Jul 3 at 18:34
36

This solution worked perfectly fine for me..

1) close XAMPP control

2) Open Activity Monitor(Launchpad->Other->Activity Monitor)

3) select filter for All processes (default is My processes)

4) in fulltext search type: httpd

5) kill all httpd items

6) relaunch XAMPP control and launch apache again

Hurray :)

5
  • 3
    This worked like a charm! Although I just did the same thing in the terminal: $ sudo killall httpd Thanks!!
    – Reid
    Commented Oct 9, 2013 at 15:24
  • the sudo command from the terminal did nothing for me. I went to the AM and killed the two httpds but they reappeared .... what should I do?
    – Teodora
    Commented Mar 9, 2014 at 8:57
  • I have a question, why xampp apache services doesn't stop when I click XAMPP APP's STOP?
    – lighter
    Commented Mar 22, 2014 at 16:03
  • Thanks. Do I have to do this every time I restart my computer??
    – molerat
    Commented Aug 14, 2017 at 10:02
  • OMG, a working answer. Thanks!
    – John Smith
    Commented Nov 6, 2023 at 10:23
22

To be able to do this, you will have to stop apache from your terminal.

sudo apachectl stop

After you've done this, your apache server will be be up and running again!

Hope this helps

3
  • This answer is identical to a previous answer. If you have something to add or improve, please suggest an edit to the original answer. Commented Dec 9, 2017 at 2:03
  • this answer also helps me. Commented Aug 21, 2019 at 4:14
  • Nope. httpd: Syntax error on line 178 of /private/etc/apache2/httpd.conf: Cannot load /opt/local/lib/apache2/modules/mod_php82.so into server: dlopen(/opt/local/lib/apache2/modules/mod_php82.so, 10): image not found To be fair, though, this might be because I've been trying "answers" from SO all night and everything is irredeemably messed up now.
    – John Smith
    Commented Nov 6, 2023 at 10:23
17

Run xampp services by command line

To start apache service

sudo /Applications/XAMPP/xamppfiles/bin/apachectl start

To start mysql service

sudo /Applications/XAMPP/xamppfiles/bin/mysql.server start

Both commands are working like charm :)

14

This is because in Mac OS X there is already Apache pre-installed. So what you can do is to change the listening port of one of the Apaches, either the Apache that you installed with XAMPP or the pre-installed one.

To change the listening port for XAMPP's Apache, go to /Applications/XAMPP/xamppfiles/etc and edit httpd.conf. Change the line "Listen 80" (80 is the listening port) to other port, eg. "Listen 1234".

Or,

To change the one for pre-installed Apache, go to /etc/apache2. You can do the same thing with file httpd.conf there.

After changing you might need to restart your Mac, just to make sure.

5

I was having this exact problem, the above solutions didn't make much sense to me.

My Solution:

Turn of Bluetooth! Worked a treat ..

After connecting my macbook pro to iphone5 (hotspot) I started getting error message, after turning of bluetooth the error message is gone ..Hope that helps somebody!

0
5

I had similar issue after integrating MongoDB into XAMPP. However executing the command "sudo apachectl stop" fixed the problem

1
  • Another tip... as far as possible avoid using default port no. I changed it to 90
    – BKP
    Commented Aug 15, 2015 at 5:57
4

Found out how to make it work!

I just moved apache2 (the Web Sharing folder) to my desktop.

  1. go to terminal and type "mv /etc/apache2/ /Users/hseungun/Desktop"

  2. actually it says you need authority so

  3. type this "sudo -s" then it'll go to bash-3.2

  4. passwd root

  5. set your password and then "mv /etc/apache2/ /Users/hseungun/Desktop"

  6. try turning on the web sharing, and then start xampp on mac

0
4

If you are also running skype at the same time. It will give you error:

port 80 running a another webserver

First close skype and restart your apache it will work fine.

4

I had success with easy killing all active httpd processes in Monitor Activity tool:

1) close XAMPP control

2) open Monitor Activity

3) select filter for All processes (default is My processes)

4) in fulltext search type: httpd

5) kill all showen items

6) relaunch XAMPP control and launch apache again

3

In my case, Web Sharing was running, which blocked XAMPP.

'Untick' Web Sharing in the Bluetooth Settings (or Network), which causes HTTPD to show in activity log.

Apache should now run and be available!

2

Same thing as mine on OS X Mavericks.

After a couple of trials by error while changing Apache configuration, I got weird output on localhost/xampp. Thought PHP engine was messed up. However, 127.0.0.1/xampp is working completely okay.

Finally, I cleaned up the browser cache and reload the page again and Voila!

Resolved on Firefox...

2

Just in case anyone comes here to look for the answer. With the latest OS of max i.e. Ventura, they have more restrictions in place. So when trying to run the Apache from the manager-osx app (XAMPP), it will keep failing due to the permission issue. To overcome this, please follow the following steps

  1. Make sure all the httpd instances are closed, for this run the following commands in the terminal.
sudo killall httpd

and after that

sudo /Applications/XAMPP/xamppfiles/bin/apachectl start
  1. After this go the the manager-osx (XAMPP) app and start the Apache again. You should be able to see the running status now.
0

As Reid mentioned above in one comment you can also do it like this:

  1. Quit XAMPP Manager-osx
  2. Run in terminal: sudo killall httpd
  3. Restart your XAMPP servers

... and you should be good to go!

0

The issue in my case was valetand I didn't know it's using port 80. If you want to use XAMPP, just stop valet by typing valet stop and run the XAMPP.

Not the answer you're looking for? Browse other questions tagged or ask your own question.