【问题标题】:OS X: Auto start PHP FCGI via launchd on system startOS X:在系统启动时通过 launchd 自动启动 PHP FCGI
【发布时间】:2011-10-12 14:06:08
【问题描述】:

所以,我从 MacPorts 连同 nginx 和 mysql 一起安装了 PHP5 FCGI。最后两个在系统启动期间加载正常。但是 PHP 没有。我创建了一个文件/opt/local/etc/LaunchDaemons/org.macports.php5/org.macports.php5-cgi.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>Label</key>
  <string>org.macports.php5-cgi</string>
  <key>ProgramArguments</key>
  <array>
    <string>/opt/local/bin/php-cgi</string>
    <string>-b127.0.0.1:9000</string>
    <string>-q</string>
  </array>
  <key>EnvironmentVariables</key>
  <dict>
    <key>PHP_FCGI_CHILDREN</key>
    <string>8</string>
    <key>PHP_FCGI_MAX_REQUESTS</key>
    <string>256</string>
  </dict>
  <key>Debug</key><false/>
  <key>Disabled</key><true/>
  <key>KeepAlive</key><true/>
</dict>
</plist>

但它不会在加载时启动。 我需要执行sudo launchctl load -w /opt/...来手动启动它。

【问题讨论】:

  • 感谢您提供此 plist 文件!许多教程在“-b”和主机名和端口之间显示一个空格。我的进程一直以 255 的状态死亡,直到我删除了那个空间。

标签: php launchd


【解决方案1】:

launchd 不会从/opt/local/etc/LaunchDaemons 读取文件。将文件放入/Library/LaunchDaemons,并删除Disabled 键。

【讨论】:

  • 谢谢你,这正是我错过的!
猜你喜欢
  • 2015-06-24
  • 2012-01-13
  • 2015-01-28
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2015-01-06
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多