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

8

11

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

Svensen answered 1/11, 2016 at 14:7 Comment(0)
H
26

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.

Histrionics answered 13/10, 2017 at 0:6 Comment(9)
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 normallyCeres
I am glad to know that this still works for you @IvanHušnjakHistrionics
Thank you so much, you saved my day :DIdiocy
oh my gosh thank you so much don't know why but your solution helped me too!Protohuman
@Protohuman I'm glad this helps, even after 3 years and some months now.Histrionics
Literally had the same problem after upgrading from Big Sur to Ventura.Hindquarter
Thank you for this! After executing this command I did "brew services restart httpd" and after that my localhost was working again.Linkwork
Wow this is the only answer that actually helped!Haily
Nice, glad it helped @HailyHistrionics
V
8

You have to run the command as the root user.

sudo apachectl stop

sudo apachectl start
Vocable answered 1/11, 2016 at 14:14 Comment(7)
The first screen shot shows a permission error. What is the error when you use sudo?Vocable
This is what I'm getting: Omars-iMac:~ Omar$ sudo apachectl start /System/Library/LaunchDaemons/org.apache.httpd.plist: Operation already in progressSvensen
I've added the screenshots above. The server still shows stopped and it no longer opens any web directories inside the localhost/Svensen
"The server still shows stopped" .... how are you getting this info? I don't see any screenshots showing that it is stopped.Vocable
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.Vocable
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.Vocable
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.Vocable
E
1

I have found a command that should locate your issue(s). In the Terminal enter: apachectl configtest

Enchanting answered 24/2, 2018 at 19:51 Comment(1)
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.Mitre
I
0

In my previous experience running the command apachectl configtest will show any configuration errors you might have. If everything is ok it will print Status OK, otherwise it will show you the config error(s). Fix those and then retry apachectl start.

Interpretive answered 1/11, 2016 at 14:38 Comment(9)
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 localhostSvensen
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.Interpretive
I added another screenshot. I already have ServerName localhost listed thereSvensen
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.Interpretive
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 messageSvensen
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.Interpretive
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/…Svensen
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 > htdocsSvensen
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.Interpretive
G
0

I solve it with following code in terminal. You can try it.

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

Gluttonize answered 17/9, 2017 at 7:36 Comment(0)
L
0

This worked for me:

sudo launchctl load -w /Applications/Server.app/Contents/ServerRoot/System/Library/LaunchDaemons/com.apple.serviceproxy.plist
Lifesaving answered 29/7, 2018 at 9:59 Comment(0)
P
0

Solvet this by run service directly trougth .plist file.

After that, service explane me what happen exactly.

In my case, i am was delete apache2 folder in /var/log.

When i was try run httpd with by command:

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

answer was empty.

Open org.apache.httpd.plist in editor, you need <string> with path to service after <key>ProgramArguments\<key> Regards!

Priscian answered 23/7, 2021 at 8:44 Comment(0)
C
0

You can try to start Apache without DocumentRoot, It's just a trick.

sudo apachectl -T
Controversy answered 26/8, 2021 at 6:23 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.