Answer the question
In order to leave comments, you need to log in
How to find out which PHP function goes into the "eternal request"?
I checked that all curls were closed, so that timeouts were everywhere.
But from time to time, a script whose task will go to google docs many times, then to the file system, then again to google_docs, then again to fs - goes into waiting until a 504 is received from nginx.
If you wait a minute and run - it will work.
Run it again - it will work again.
But from time to time, quite by accident, it will go into waiting.
How to understand where the script stopped to check what's wrong?
There are concerns about the operation of the write-read functions in the OS, because this bug periodically pops up when you work with uploads, where you also need to open a file, close the file, read, send ...
Answer the question
In order to leave comments, you need to log in
Just call an exception or make a handler for this code, after setting the timeout in seconds.
curl_setopt($ch, CURLOPT_TIMEOUT, 400); // время в секундах
// тут ваш код запрос страницы
$httpcode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
if ($httpcode == 0) { throw new Exception("No connection"); }
if ($httpcode == 504) { throw new Exception("504 can't connect"); }
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question