douxie1692 2013-10-10 15:37
浏览 34
已采纳

强制PHP使用命令行概述错误

I'm trying to debug a PHP application that is running from the command line. I want to use a cronjob later on to invoke the module every hour.

For debugging I execute the PHP script like this:

php -c /etc/php5/apache2/php.ini /var/www/module/test/autostart/start.php 12 &

(forget about the „12“ - it's a parameter for the script)

Now basically I get this output via SSH:

[2] 10181
[1] Done                php -c /etc/php5/apache2/php.ini /var/www/module/test/autostart/start.php 12 

I have no idea what I have changed but a few weeks ago I got the actual php errors directly on the screen. That's what I expect. But I don't know how to force PHP to output me the result directly.

  • 写回答

3条回答 默认 最新

  • dongmu5246 2013-10-10 15:57
    关注

    When you use & at the end, command is started in background. You can see background processes by command jobs. When you try it, you can see php process in 'stopped' state.

    Problem is that php is waiting for input. It is caused by this php extension:

    readline php extension

    Run it this way:

    php -c /etc/php5/apache2/php.ini /var/www/module/test/autostart/start.php 12 < /dev/null &
    

    or disable that extension.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

悬赏问题

  • ¥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