68

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?

Adriaan
  • 17,741
  • 7
  • 42
  • 75
Amit Battan
  • 2,968
  • 2
  • 32
  • 68
  • 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. – Amit Battan Jan 03 '11 at 07: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 – Amit Battan Jan 03 '11 at 10:34

17 Answers17

222

This is what helped me:

sudo apachectl stop

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

Andrew Tobilko
  • 48,120
  • 14
  • 91
  • 142
Yakov Fain
  • 11,972
  • 5
  • 33
  • 38
63

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.

Steve Clay
  • 8,671
  • 2
  • 42
  • 48
  • 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 Sep 23 '12 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 Nov 09 '12 at 19:20
  • Going on 10 years later and this solution still worked for me. – Addy Oct 18 '19 at 14:07
  • Works like a charm on m1 macs – konnovdev Dec 18 '22 at 04:42
55

try

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

in terminal

Sahil Doshi
  • 1,073
  • 10
  • 23
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 :)

minhas23
  • 9,291
  • 3
  • 58
  • 40
  • 3
    This worked like a charm! Although I just did the same thing in the terminal: $ sudo killall httpd Thanks!! – Reid Oct 09 '13 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 Mar 09 '14 at 08:57
  • I have a question, why xampp apache services doesn't stop when I click XAMPP APP's STOP? – lighter Mar 22 '14 at 16:03
  • Thanks. Do I have to do this every time I restart my computer?? – molerat Aug 14 '17 at 10:02
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

Acire
  • 270
  • 2
  • 13
16

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 :)

Kamlesh
  • 5,233
  • 39
  • 50
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.

Surya Wijaya Madjid
  • 1,823
  • 1
  • 19
  • 25
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!

user2021537
  • 51
  • 1
  • 1
5

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

BKP
  • 51
  • 1
  • 1
  • Another tip... as far as possible avoid using default port no. I changed it to 90 – BKP Aug 15 '15 at 05:57
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.

Taryn
  • 242,637
  • 56
  • 362
  • 405
priyanka
  • 41
  • 1
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

Jan P.
  • 228
  • 1
  • 2
  • 11
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

Steve Ham
  • 3,067
  • 1
  • 29
  • 36
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!

SkyBlu
  • 25
  • 1
  • 1
  • 8
chris hays
  • 31
  • 1
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...

Ken Pega
  • 534
  • 6
  • 9
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!

MacGregor
  • 51
  • 4
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.

Nijat Mursali
  • 930
  • 1
  • 8
  • 20
0

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.
Tyler2P
  • 2,324
  • 26
  • 22
  • 31