OS X: Auto start PHP FCGI via launchd on system start

╄→гoц情女王★ 提交于 2019-12-05 02:09:29

问题


So, I installed PHP5 FCGI from MacPorts along with nginx and mysql. Last two are loading fine during system start. But PHP doesn't. I created a file /opt/local/etc/LaunchDaemons/org.macports.php5/org.macports.php5-cgi.plist and put this contents to it:

<?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>

But it won't start on load. I need to execute sudo launchctl load -w /opt/... to start it manually.


回答1:


launchd doesn't read files from /opt/local/etc/LaunchDaemons. Put the file in /Library/LaunchDaemons, and remove the Disabled key.



来源:https://stackoverflow.com/questions/7741365/os-x-auto-start-php-fcgi-via-launchd-on-system-start

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!