I have a php script that scrapes the web and inserts the scraped data into a database.
This php script runs for a very long time(about a couple of hours).
Sometimes, after the script runs for a long time, the php script just stops executing and shows no error.
The problem isn't caused due to the amount of execution time of the script because i set the php script to an unlimited amount of execution time.
ini_set('max_execution_time', 0);
I also set the php script to show all errors.
ini_set('display_errors',1);
error_reporting(E_ALL);
But I get no error after the php script stops execution.
I also ran the script in several other computers and i still encounter the same problem, so the problem isn't due to server restrictions either.
I researched the issue and apparently it's a networking problem.
The php script stops communicating with the server and disconnects from it(probably because the php script sent a http request and didn't receive any response).
My question is this:
Is there any way I can check for network disconnections through the php script, and resume the script and try to reconnect if there was a network disconnection?