I have a script, lets call it linkchecker, that loops through about 10.000 URLs, checking them for http status codes.
When they are checked, the url is marked as checked in my DB.
It wont output anything until its done, which can take many hours.
So I thought about just having another script that will run the linkchecker in the background, while continually polling the DB about how many URLs are checked, so I can follow the progress, and if any URLs are giving a problem with long connection time and so on.
I tried just running the linkchecker in an iframe, but nothing will load until the linkchecker has finished.
How can i execute this linkchecker in the background while the main script runs normally, executing other tasks?
You have to set a cron job (if you are running Linux) that executes a curl command to access a PHP script (external, like ‘curl http://domain.com/php/something.php‘) or just executing a php command pointing to a internal file.
You can make a scheduler that executes every minute (that’s the minimum execution time supported by cron job) and executes a “block” of your work. Of course, you must set PHP to skip the 30 seconds execution limit used by default.