I have an APP that pulls in some data via curl using the timer feature.
The timer id set to execute php code <?php include('cron.php'); ?> at an interval of 5000. It’s working but the APP hangs and becomes unresponsive, until the timer has finished.
Do have any suggestions to improve this ?
What does your cron.php job do?
The cron job run a script that checks urls for redirect using curl. Just one url is checked each time the cron is fired.
Check out: http://php.net/manual/en/function.exec.php and read the note:
“If a program is started with this function, in order for it to continue running in the background, the output of the program must be redirected to a file or another output stream. Failing to do so will cause PHP to hang until the execution of the program ends.”
This article helped us: https://www.paul-norman.co.uk/2009/06/asynchronous-curl-requests/
1 Like
Thanks for the help. I’ve managed to improve things a bit.