Mac Apache web server won't start anymore and can't find any web directories

15,444

Solution 1

After 48 hours of research, I found this working solution, I found the solution here: disable OSX's built-in Apache server.

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

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

Solution 2

You have to run the command as the root user.

sudo apachectl stop

sudo apachectl start
Share:
15,444
Omar
Author by

Omar

Updated on August 01, 2022

Comments

  • Omar
    Omar almost 2 years

    I'm on Mac Yosemite 10.10.5. Apache web server suddenly no longer starts. I tried changing the port to 8080. Also tried sudo apachectl stop and sudo apachectl start. Still won't open.

    I thought this may have happened after adding a new printer and enabling print sharing. I turned that off and it still won't start. I can't remember which command I ran that gave me this message with some more details.

    enter image description here

    UPDATE: When I use sudo apachectl start, I noticed the server is accessible through the browser even though the interface still says STOPPED, but when I go to localhost/webdirectory I just get not found.

    enter image description here enter image description here

    enter image description here

    enter image description here

    enter image description here

  • infinigrove
    infinigrove over 7 years
    The first screen shot shows a permission error. What is the error when you use sudo?
  • Omar
    Omar over 7 years
    This is what I'm getting: Omars-iMac:~ Omar$ sudo apachectl start /System/Library/LaunchDaemons/org.apache.httpd.plist: Operation already in progress
  • Omar
    Omar over 7 years
    I've added the screenshots above. The server still shows stopped and it no longer opens any web directories inside the localhost/
  • infinigrove
    infinigrove over 7 years
    "The server still shows stopped" .... how are you getting this info? I don't see any screenshots showing that it is stopped.
  • Omar
    Omar over 7 years
    I'm getting: |||| AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using Omars-iMac.local. Set the 'ServerName' directive globally to suppress this message Syntax OK. |||| the server's name is: ServerName localhost
  • R T
    R T over 7 years
    Well, that error appears because your ServerName is not setup in your httpd.conf file. You will need to edit httpd.conf and add the line ServerName localhost right after ServerAdmin. Save and restart apache.
  • Omar
    Omar over 7 years
    I added another screenshot. I already have ServerName localhost listed there
  • R T
    R T over 7 years
    Assuming that you can run commands as root, could you please run httpd -t. Just making sure that the syntax you are using in your httpd.conf file is correct.
  • Omar
    Omar over 7 years
    Weird I get the same error: httpd: Could not reliably determine the server's fully qualified domain name, using Omars-iMac.local. Set the 'ServerName' directive globally to suppress this message
  • infinigrove
    infinigrove over 7 years
    I see your latest screen shot. It seems odd that Server Manager shows that it is stopped but you get a webpage and "Operation already in progress" error.
  • R T
    R T over 7 years
    I don't want to sound patronising, but you are certain that the httpd.conf file that you are editing is the /etc/apache2/httpd.conf ? Because it seems like your httpd.conf file is ignored.
  • Omar
    Omar over 7 years
    Sorry guys, does it help to see all my httpd.conf. I feel like something else is going on: [link]docs.google.com/document/d/…
  • infinigrove
    infinigrove over 7 years
    Also, localhost is not a fully qualified domain name. I believe the message "Could not reliably determine the server's fully qualified domain name..." is more of a warning than an actual error message and should not stop the server from running.
  • Omar
    Omar over 7 years
    I have two it seems: xamppfiles > etc > httpd.conf and xamppfiles > apache2 > conf > httpd.conf. There seems to be htdocs folder under both areas, but all my web directories are really here: xamppfiles > htdocs
  • R T
    R T over 7 years
    If you are using XAMPP, then I think the config file that you should be editing is /Applications/XAMPP/xamppfiles/etc/httpd.conf (assuming that you kept the default path on XAMPP installation). You also might want to try sudo /Applications/XAMPP/xamppfiles/bin/apachectl start Just in case you have multiple Apache installations on your system.
  • infinigrove
    infinigrove over 7 years
    I would recommend setting the ServerName to the local IP address like it recommends in the configuration file rather than setting it to ServerName localhost. However, if your server is assigned an IP address by DHCP you will need to make sure that it always gets the same IP address.
  • Jason Aller
    Jason Aller about 6 years
    When adding answers to older questions with existing answers it is useful to point out what new things your answer brings to the question. In this case Radu's answer already appears to include apachectl configtest and it discusses how to interpret the results.
  • Ivan Hušnjak
    Ivan Hušnjak almost 6 years
    This still works even on MacOS High Sierra 10.13.6. After update to 10.13.5 my MAMP apache server was unable to load on port 80, and after running this command I as able to run it normally
  • nensamuel
    nensamuel over 5 years
    I am glad to know that this still works for you @IvanHušnjak
  • jackcar
    jackcar over 5 years
    Thank you so much, you saved my day :D
  • dulerong
    dulerong about 3 years
    oh my gosh thank you so much don't know why but your solution helped me too!
  • nensamuel
    nensamuel over 2 years
    @dulerong I'm glad this helps, even after 3 years and some months now.