douzepao0281 2013-04-07 06:07
浏览 86
已采纳

mac osx上的PHP Fast CGI - php fcgi.plist不是由加载运行,也不是由reboot重启

I have loaded phpcgi.plist but php-fastcgi is not runing.

The plist file is:

Michaels-MacBook-Pro:~ michael$ ll com*
-rwxr--r--  1 michael  admin  664  4  7 13:40 com.phpfcgi.plist*

The plist XML:

Michaels-MacBook-Pro:~ michael$ cat com.phpfcgi.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>Debug</key>
  <false/>
  <key>EnvironmentVariables</key>
  <dict>
    <key>PHP_FCGI_CHILDREN</key>
    <string>2</string>
    <key>PHP_FCGI_MAX_REQUESTS</key>
    <string>1000</string>
  </dict>
  <key>Label</key>
  <string>com.phpfcgi</string>
  <key>OnDemand</key>
  <false/>
  <key>ProgramArguments</key>
  <array>
    <string>/usr/local/bin/php-cgi</string>
    <string>-b 127.0.0.1:9000</string>
    <string>-q</string>
  </array>
  <key>RunAtLoad</key>
  <false/>
</dict>
</plist>

Linked it:

Michaels-MacBook-Pro:~ michael$ ll Library/LaunchAgents/com.phpfcgi.plist
lrwxr-xr-x  1 michael  admin  47  4  7 13:27 Library/LaunchAgents/com.phpfcgi.plist@ -> /Volumes/MainHD/Users/michael/com.phpfcgi.plist

and I load it:

Michaels-MacBook-Pro:~ michael$ launchctl load -w Library/LaunchAgents/com.phpfcgi.plist
com.phpfcgi: Already loaded

and I check it:

Michaels-MacBook-Pro:~ michael$ ps -A | grep php
 1110 ttys000    0:00.00 grep php

NOT WORKING.

But I can start php fastcgi by run.

Michaels-MacBook-Pro:~ michael$ cat start_php-fastcgi
/usr/local/bin/php-cgi -q -b 127.0.0.1:9000 &
  • 写回答

2条回答 默认 最新

  • dongya767979565 2013-04-08 05:52
    关注

    should no space between "-b" and the host (my system is osx 10.8)

    I found a comment:

    Thank you for this plist file! A lot of the tutorials show a space between "-b" and the host name and port. My process kept dying with a status of 255, until I removed that space. – Matt Aug 26 '12 at 16:24

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

    It solved my problem.

    The new 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>EnvironmentVariables</key>
      <dict>
        <key>PHP_FCGI_CHILDREN</key>
        <string>2</string>
        <key>PHP_FCGI_MAX_REQUESTS</key>
        <string>1000</string>
      </dict>
      <key>Label</key>
      <string>com.phpfcgi</string>
      <key>ProgramArguments</key>
      <array>
        <string>/usr/local/opt/php54/bin/php-cgi</string>
        <string>-b127.0.0.1:9000</string>
        <string>-q</string>
      </array>
      <key>RunAtLoad</key>
      <true/>
    </dict>
    </plist>
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 drone 推送镜像时候 purge: true 推送完毕后没有删除对应的镜像,手动拷贝到服务器执行结果正确在样才能让指令自动执行成功删除对应镜像,如何解决?
  • ¥15 求daily translation(DT)偏差订正方法的代码
  • ¥15 js调用html页面需要隐藏某个按钮
  • ¥15 ads仿真结果在圆图上是怎么读数的
  • ¥20 Cotex M3的调试和程序执行方式是什么样的?
  • ¥20 java项目连接sqlserver时报ssl相关错误
  • ¥15 一道python难题3
  • ¥15 牛顿斯科特系数表表示
  • ¥15 arduino 步进电机
  • ¥20 程序进入HardFault_Handler