Mac Apache web server won't start anymore and can't find any web directories
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
Omar
Updated on August 01, 2022Comments
-
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.
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. -
infinigrove over 7 yearsThe first screen shot shows a permission error. What is the error when you use sudo?
-
Omar over 7 yearsThis is what I'm getting: Omars-iMac:~ Omar$ sudo apachectl start /System/Library/LaunchDaemons/org.apache.httpd.plist: Operation already in progress
-
Omar over 7 yearsI've added the screenshots above. The server still shows stopped and it no longer opens any web directories inside the localhost/
-
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 over 7 yearsI'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 over 7 yearsWell, that error appears because your
ServerName
is not setup in yourhttpd.conf
file. You will need to edithttpd.conf
and add the lineServerName localhost
right afterServerAdmin
. Save and restart apache. -
Omar over 7 yearsI added another screenshot. I already have ServerName localhost listed there
-
R T over 7 yearsAssuming that you can run commands as root, could you please run
httpd -t
. Just making sure that the syntax you are using in yourhttpd.conf
file is correct. -
Omar over 7 yearsWeird 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 over 7 yearsI 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 over 7 yearsI 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 yourhttpd.conf
file is ignored. -
Omar over 7 yearsSorry 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 over 7 yearsAlso, 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 over 7 yearsI 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 over 7 yearsIf 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 trysudo /Applications/XAMPP/xamppfiles/bin/apachectl start
Just in case you have multiple Apache installations on your system. -
infinigrove over 7 yearsI 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 about 6 yearsWhen 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 almost 6 yearsThis 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 over 5 yearsI am glad to know that this still works for you @IvanHušnjak
-
jackcar over 5 yearsThank you so much, you saved my day :D
-
dulerong about 3 yearsoh my gosh thank you so much don't know why but your solution helped me too!
-
nensamuel over 2 years@dulerong I'm glad this helps, even after 3 years and some months now.