I'm trying to install zend server on mac and need to uninstall the apache server that is auto included with Mavericks so that the Apache server included with Zend is used instead. Can it be prevented from running on startup or permanently removed?
-
17Stupid decision to close this, as it is clearly related to software development. In fact, this question would not be acceptable in Server Fault as it does not deal with server administration. Nobody is using Mavericks as a server OS, they are using it on their dev machines, making this a question about dev tools.– JehanJul 21, 2014 at 16:13
-
Reeeeeeeeeeeeeee– Walrus the CatApr 25, 2018 at 2:53
4 Answers
Try this:
sudo launchctl unload -w /System/Library/LaunchDaemons/org.apache.httpd.plist
This will stop a running instance of Apache, and record that it should not be restarted. It records your preference in /private/var/db/launchd.db/com.apple.launchd/overrides.plist
.
-
5
-
12Edgar, you need to have an apache instance running already for this command to work. sudo apachectl start Feb 7, 2014 at 21:50
-
29This doesn't seem to work on Mac 10.10 Yosemite. Says /System/Library/LaunchDaemons/org.apache.httpd.plist: Could not find specified service.– cchieraJun 13, 2014 at 14:29
-
1It's not working on Yosemite Beta 5. I get the same message as @cchiera– JamesAug 5, 2014 at 21:39
-
7Works on Yosemite 5 - apache needs to be running before issuing the command Oct 12, 2014 at 21:15
try this
sudo killall httpd
it will stop all
-
3This only stops the httpd service. It doesn't prevent it from starting upon restart. Apr 1, 2018 at 17:11
I ran into this same problem, and the culprit was pretty obtuse. It wound up that OSX was attempting to include a nonexistent php version, however the OSX httpd was also not directly accessible due to the homebrew httpd taking priority. Here's what I did that fixed it:
First: brew unlink httpd
Then which httpd
revealed the following: /usr/sbin/httpd
At this point I ran sudo /usr/sbin/httpd -k stop
, and the real culprit revealed itself:
httpd: Syntax error on line 527 of /private/etc/apache2/httpd.conf: Syntax error on line 8 of /private/etc/apache2/other/+php-osx.conf: Cannot load /usr/local/php5/libphp5.so into server: dlopen(/usr/local/php5/libphp5.so, 10): Symbol not found: _environ\n Referenced from: /usr/local/php5/libphp5.so\n Expected in: /usr/sbin/httpd\n in /usr/local/php5/libphp5.so
I then fixed this with sudo vi /private/etc/apache2/httpd.conf
, and commented out all of the lines in that file, and ran the following for good measure:
sudo launchctl unload -w /System/Library/LaunchDaemons/org.apache.httpd.plist
This stated:
/System/Library/LaunchDaemons/org.apache.httpd.plist: Could not find specified service
The underlying problem was that the native OSX instance was still running, but had become detached from launchctl
due to the PHP not found issue. So basically launchctl
thought it had properly shut the process down, but the apachectl
agent refused to stop due to the PHP error, resulting in a decoupled process, which was only accessible for direct control when the homebrew version was also unlinked.
Commenting out the native PHP include allowed me to run sudo apachectl -k stop
without issue.
After sorting this out, I then ran
brew link httpd
followed by
brew services restart httpd
Profit.
If you got to this page as I did and was getting something like /System/Library/LaunchDaemons/org.apache.httpd.plist: Could not find specified service.
try NOT using the sudo command, which was making me get the above error.
-
10Hmm, even without sudo I get this problem... Any other ideas? Apr 14, 2016 at 11:42
-
1Tells me
This operation requires root.
without sudo,apachectl stop
Jan 17, 2019 at 19:35