Reputation: 17393
I'm using this package to run my bash:
use Symfony\Component\Process\Process;
use Symfony\Component\Process\Exception\ProcessFailedException;
I got this error when I want to run my bash inside 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);
}
my max_execution_time
inside phpinfo
function is 240. I restarted my server.
my safe_mode
is off. I used this function :
set_time_limit(0);
above my code, but after 60 seconds I got the same error message.
my .htdaccess
is 240 seconds.
any idea?
Upvotes: 4
Views: 8561
Reputation: 39
If you want to disable the setTimeout
or setIdleTimeout
completely, simply set them as null
:
$process->setTimeout(null);
$process->setIdleTimeout(null);
Upvotes: 2
Reputation: 440
The Process
class has a timeout of its own, according to 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();
You should check the idleTimetout
as well, if the process may take a long time without outputing any data:
$process->setIdleTimeout(240);
The docs doesn't say anything about using 0
as no limit.
Upvotes: 12