【问题标题】:How to set a timeout to shell commands executed with PHP in Windows如何为在 Windows 中使用 PHP 执行的 shell 命令设置超时
【发布时间】:2014-03-22 09:57:45
【问题描述】:

我正在使用 passthru($command) 来执行 imagemagick 转换命令。

简单来说,如果这个shell命令本身因为一些无法解释的原因卡住了,那么passthru()也卡住了。如何设置此 passthru 代码的超时限制,例如 2 分钟?我想获得一个返回值是为了进行错误的案例处理,而不是 set_time_limit()

【问题讨论】:

    标签: php shell timeout exec


    【解决方案1】:

    看看这篇文章:

    PHP shell_exec 超时

    此函数允许您执行另一个进程,但允许运行多长时间超时。

    http://blog.dubbelboer.com/2012/08/24/execute-with-timeout.html

    【讨论】:

      猜你喜欢
      • 2012-06-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-10-06
      • 2015-08-18
      • 1970-01-01
      • 1970-01-01
      • 2011-08-03
      相关资源
      最近更新 更多