Simulate Cron jobs using PHP
P粉207483087
P粉207483087 2023-09-04 14:03:57
0
1
519
<p>I am running an LMS (Learning Management System) online and it needs to run a file called "training/admin/cli/cron.php" every minute. The problem is that my host only allows cron jobs to run every 30 minutes. </p> <p>I tried creating a file called cron_script.php with the following content and setting it to run every 30 minutes: </p> <pre class="brush:php;toolbar:false;"><?php set_time_limit(0); $turns=0; while($turns < 30) { exec('training/admin/cli/cron.php'); sleep(60); $turns ; } ?></pre> <p>But it only seems to run once. I don't even know how to fix the error message since it is run by cron so I can't print it anywhere. </p>
P粉207483087
P粉207483087

reply all(1)
P粉475315142

this is possible. Because the default run time limit is 30 seconds. Use this function https://www.php.net/manual/en/ function.set-time-limit.php Or modify the "max_execution_time" value of the php.ini file.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template