max_execution_time 为 240 秒 - 超过 60 秒的超时

S.M*_*ian 4 php centos laravel

我正在使用这个包来运行我的 bash:

use Symfony\Component\Process\Process;
use Symfony\Component\Process\Exception\ProcessFailedException;
Run Code Online (Sandbox Code Playgroud)

当我想在 laravel 中运行 bash 时出现此错误:

进程 ***/my.sh 超出了 60 秒的超时时间。

$process = new Process('sh ***/my.sh');
       $process->run();

       // executes after the command finishes
       if (!$process->isSuccessful()) {
          throw new ProcessFailedException($process);
       }
Run Code Online (Sandbox Code Playgroud)

我的max_execution_time内部phpinfo函数是240。我重新启动了我的服务器。我的safe_mode已关闭。我使用了这个功能:

set_time_limit(0);
Run Code Online (Sandbox Code Playgroud)

高于我的代码,但 60 秒后我收到了相同的错误消息。我的.htdaccess是240秒。

任何想法?

Dan*_*sta 10

根据Process 文档,该类Process有自己的超时:

默认情况下,进程的超时时间为 60 秒,但您可以通过向setTimeout()方法传递不同的超时时间(以秒为单位)来更改它:

use Symfony\Component\Process\Process;

$process = new Process('sh ***/my.sh');
$process->setTimeout(240);
$process->run();
Run Code Online (Sandbox Code Playgroud)

idleTimetout如果该过程可能需要很长时间而不输出任何数据,您还应该检查:

$process->setIdleTimeout(240);
Run Code Online (Sandbox Code Playgroud)

该文档没有提到任何关于使用0as no limit 的内容。