10

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

Omar
  • 786
  • 3
  • 13
  • 34

8 Answers8

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.

nensamuel
  • 566
  • 8
  • 10
8

You have to run the command as the root user.

sudo apachectl stop

sudo apachectl start
infinigrove
  • 489
  • 1
  • 7
  • 16
  • The first screen shot shows a permission error. What is the error when you use sudo? – infinigrove Nov 01 '16 at 14:20
  • This is what I'm getting: Omars-iMac:~ Omar$ sudo apachectl start /System/Library/LaunchDaemons/org.apache.httpd.plist: Operation already in progress – Omar Nov 01 '16 at 14:23
  • I've added the screenshots above. The server still shows stopped and it no longer opens any web directories inside the localhost/ – Omar Nov 01 '16 at 14:26
  • "The server still shows stopped" .... how are you getting this info? I don't see any screenshots showing that it is stopped. – infinigrove Nov 01 '16 at 14:33
  • 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. – infinigrove Nov 01 '16 at 14:58
  • 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. – infinigrove Nov 01 '16 at 15:02
  • 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. – infinigrove Nov 01 '16 at 15:13
1

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

Kat Joy
  • 21
  • 2
  • 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. – Jason Aller Feb 24 '18 at 20:18
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.

R T
  • 1,038
  • 9
  • 17
  • 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 – Omar Nov 01 '16 at 14:41
  • 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. – R T Nov 01 '16 at 14:46
  • I added another screenshot. I already have ServerName localhost listed there – Omar Nov 01 '16 at 14:48
  • 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. – R T Nov 01 '16 at 14:53
  • 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 – Omar Nov 01 '16 at 14:53
  • 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. – R T Nov 01 '16 at 15:00
  • Sorry guys, does it help to see all my httpd.conf. I feel like something else is going on: [link]https://docs.google.com/document/d/1DVxWRgorznWnmItZkOTRjkPslPcTL8O5cYeLGwKgmmM/edit?usp=sharing[/link] – Omar Nov 01 '16 at 15:01
  • 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 – Omar Nov 01 '16 at 15:04
  • 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. – R T Nov 01 '16 at 15:11
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

appbanana
  • 21
  • 1
0

This worked for me:

sudo launchctl load -w /Applications/Server.app/Contents/ServerRoot/System/Library/LaunchDaemons/com.apple.serviceproxy.plist
baikho
  • 5,203
  • 4
  • 40
  • 47
n1g_
  • 1
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!

jacobkim
  • 1,043
  • 10
  • 20
a1i3n
  • 7
  • 3
0

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

sudo apachectl -T
Rawan-25
  • 1,753
  • 1
  • 17
  • 25