OS X 10.10 上的 Apache 服务器几分钟后关闭

OS X 10.10 上的 Apache 服务器几分钟后关闭

我正在尝试使用 OS X 10.10 上的 Apache 在内部网中运行 PHP 应用程序。我可以使用以下命令成功启动 Apache:

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

PHP 应用程序运行正常,可以从其他机器访问。但是,几分钟后 Apache 就崩溃了,/var/log/apache2/error_log 中没有任何有用的错误消息

[Sat Jan 02 22:21:38.685725 2016] [mpm_prefork:notice] [pid 112] AH00163: Apache/2.4.16 (Unix) PHP/5.5.29 configured -- resuming normal operation
[Sat Jan 02 22:21:38.685807 2016] [mpm_prefork:info] [pid 112] AH00164: Server built: Jul 22 2015 21:03:09
[Sat Jan 02 22:21:38.685828 2016] [core:notice] [pid 112] AH00094: Command line: '/usr/sbin/httpd -D FOREGROUND'
[Sat Jan 02 22:21:38.685839 2016] [mpm_prefork:debug] [pid 112] prefork.c(992): AH00165: Accept mutex: flock (default: flock) [Sat Jan 02 22:21:40.000785 2016] [core:info] [pid 112] AH00096: removed PID file /private/var/run/httpd.pid (pid=112)
[Sat Jan 02 22:21:40.000820 2016] [mpm_prefork:notice] [pid 112] AH00169: caught SIGTERM, shutting down
[Sun Jan 03 07:49:55.202584 2016] [mpm_prefork:notice] [pid 6104] AH00163: Apache/2.4.16 (Unix) PHP/5.5.29 configured -- resuming normal operation
[Sun Jan 03 07:49:55.202661 2016] [core:notice] [pid 6104] AH00094: Command line: '/usr/sbin/httpd -D FOREGROUND'
[Sun Jan 03 08:16:48.067316 2016] [mpm_prefork:notice] [pid 6104] AH00169: caught SIGTERM, shutting down
[Sun Jan 03 08:59:41.027663 2016] [mpm_prefork:notice] [pid 50443] AH00163: Apache/2.4.16 (Unix) PHP/5.5.29 configured -- resuming normal operations
[Sun Jan 03 08:59:41.027735 2016] [core:notice] [pid 50443] AH00094: Command line: '/usr/sbin/httpd -D FOREGROUND'
[Sun Jan 03 09:18:07.822248 2016] [mpm_prefork:notice] [pid 50443] AH00169: caught SIGTERM, shutting down

我的 org.apache.httpd.plist 如下:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
        <key>Disabled</key>
        <false/>
        <key>EnvironmentVariables</key>
        <dict>
                <key>XPC_SERVICES_UNAVAILABLE</key>
                <string>1</string>
                <key>PATH</key>
                <string>/opt/local/bin:/opt/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin</string>
        </dict>
        <key>Label</key>
        <string>org.apache.httpd</string>
        <key>KeepAlive</key>
        <true/>
        <key>ProgramArguments</key>
        <array>
                <string>/usr/sbin/httpd-wrapper</string>
                <string>-D</string>
                <string>FOREGROUND</string>
        </array>
</dict>
</plist>

/var/log/apache2 中没有 php_error 日志。

与此问题相关的可能是我遇到的这个问题,Apache 在重启后 2 秒关闭:https://stackoverflow.com/questions/34571520/apache-wont-start-on-boot-on-os-x-10-10

相关内容