60 seconds is probably the max execution time set in php.ini
Perhaps try calling that code from a console command, which often has no max execution time (while an http request might). It’s possible theres a limit set for cli-called php as well tho.
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
After a series of tests, because I couldn't understand what was happening to me in the end, I chose to gradually increase the timeout, until I reached the point where I suspected there was a problem.
## 60 seconds of timeout not work
Yes, if I use a timeout equal to or greater than 60 seconds. the HTTP client no longer returns anything, even if the server returns data to it.
For the tests, use a fake endpoint that does not offer a timeout with error 500 until after 3 minutes.
I started with a 20-second timeout, went up to 30, 40, 50, and wham. At 60 it stopped working. Of course 59 works fine.
The client never died and the code set for the debug was never reached.
I have checked the configuration of my PHP instance in Sail, and there is no limit to 60 seconds
So with these data I don't know where the error is that I can correct so that the HTTP client obtains a timeout error when it is equal to or greater than 60.
The code is in a job that works in queues with redis (horizon as supervisor)
I needed a lot of calls to ray because I didn't understand what was going on. That was what it showed me, that the call after 60 seconds remains without getting an answer or timeout. It doesn't even respond even though it reaches 180 from the server, which returns a 500 error.
try {
// I use the code below to continue working with the app, but I need a timeout of 160 seconds.
// $timeout = (config('sitelight.queues.modem.api.timeout') >= 60)
// ? 59
// : (config('sitelight.queues.modem.api.timeout'));
$timeout = 60;
ray('Check code enter '); \ If $timeout >= 60 Only one time read this message and NEVER get Exception or $reponse
$response = Http::timeout($timeout)
->withHeaders([
'Accept' => 'application/json',
])
->withOptions([
'verify' => app()->environment('production'),
])
->get($this->endpoint);
} catch (ConnectionException $e) {
\ If $timeout >= 60 Only one time read this message and NEVER get Exception or
ray($e->getMessage());
ray($this->tries);
ray($this->attempts());
if ($this->attempts() < $this->tries) {
ray("Attempts ".$this->attempts());
//$this->fail();
throw new Exception("$modem error timeout server with response code}");
} else {
ray("Attempts ".$this->attempts(). " We need save data");
$this->saveErrorInDatabase($e->getMessage(),408);
//$this->fail();
return;
}
} catch (Exception $e) {
\ If $timeout >= 60 Only one time read this message and NEVER get Exception or
ray($e->getMessage())->die();
}
Please or to participate in this conversation.