max_execution_time 是 240 秒 - 超过了 60 秒的超时
max_execution_time is 240 second - exceeded the timeout of 60 seconds
我正在使用这个包 运行 我的 bash:
use Symfony\Component\Process\Process;
use Symfony\Component\Process\Exception\ProcessFailedException;
当我想 运行 我的 bash 里面 laravel:
时出现这个错误
The process ***/my.sh exceeded the timeout of 60 seconds.
$process = new Process('sh ***/my.sh');
$process->run();
// executes after the command finishes
if (!$process->isSuccessful()) {
throw new ProcessFailedException($process);
}
我的 max_execution_time
在 phpinfo
函数中是 240。我重新启动了我的服务器。
我的 safe_mode
已关闭。我使用了这个功能:
set_time_limit(0);
在我的代码上方,但 60 秒后我收到了相同的错误消息。
我的 .htdaccess
是 240 秒。
有什么想法吗?
Process
class 有自己的超时时间,根据 Process docs:
By default processes have a timeout of 60 seconds, but you can change it passing a different timeout (in seconds) to the setTimeout()
method:
use Symfony\Component\Process\Process;
$process = new Process('sh ***/my.sh');
$process->setTimeout(240);
$process->run();
你也应该检查idleTimetout
,如果这个过程可能需要很长时间没有输出任何数据:
$process->setIdleTimeout(240);
文档没有说明使用 0
作为无限制。
如果您想完全禁用 setTimeout
或 setIdleTimeout
,只需将它们设置为 null
:
$process->setTimeout(null);
$process->setIdleTimeout(null);
我正在使用这个包 运行 我的 bash:
use Symfony\Component\Process\Process;
use Symfony\Component\Process\Exception\ProcessFailedException;
当我想 运行 我的 bash 里面 laravel:
时出现这个错误The process ***/my.sh exceeded the timeout of 60 seconds.
$process = new Process('sh ***/my.sh');
$process->run();
// executes after the command finishes
if (!$process->isSuccessful()) {
throw new ProcessFailedException($process);
}
我的 max_execution_time
在 phpinfo
函数中是 240。我重新启动了我的服务器。
我的 safe_mode
已关闭。我使用了这个功能:
set_time_limit(0);
在我的代码上方,但 60 秒后我收到了相同的错误消息。
我的 .htdaccess
是 240 秒。
有什么想法吗?
Process
class 有自己的超时时间,根据 Process docs:
By default processes have a timeout of 60 seconds, but you can change it passing a different timeout (in seconds) to the
setTimeout()
method:
use Symfony\Component\Process\Process;
$process = new Process('sh ***/my.sh');
$process->setTimeout(240);
$process->run();
你也应该检查idleTimetout
,如果这个过程可能需要很长时间没有输出任何数据:
$process->setIdleTimeout(240);
文档没有说明使用 0
作为无限制。
如果您想完全禁用 setTimeout
或 setIdleTimeout
,只需将它们设置为 null
:
$process->setTimeout(null);
$process->setIdleTimeout(null);