How to stop apache permanently on mac Mavericks?

2019-03-07 17:43发布

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?

4条回答
兄弟一词,经得起流年.
2楼-- · 2019-03-07 17:52

try this

sudo killall httpd

it will stop all

查看更多
女痞
3楼-- · 2019-03-07 18:07

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.

查看更多
相关推荐>>
4楼-- · 2019-03-07 18:08

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楼-- · 2019-03-07 18:12

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.

查看更多
登录 后发表回答