Execute php script on server every 5 minutes
<p>I want to run a php script every 5 minutes that processes some simple mysql queries to identify potential errors and in case an error is recorded as a database entry the php script sends out an email.</p>

<p>From my research, it seems like cron jobs (or task schedulers) usually take care of running scripts at specified times, however I cannot find this option anywhere at the hosting service I am using (who runs "Parallels Plesk Panel 11.0.9" as the management interface I can access).</p>

<p>Therefore I tried the following "trick":</p>

<pre><code>&lt;?php
$active = $_GET["a"];
set_time_limit(0);
while($active == 1){
    include 'alert_exe.php';
    sleep(300); // execute script every 5 mins
}
?&gt;
</code></pre>

<p>To active the script I enter the url (".../alert.php?a=1"). This works fine for a couple of minutes, however it seems after 2 or 3 minutes the script stops executing.</p>

<p>Any idea how I can prevent the stopping of the script or alternative suggestions how to achieve the automatic execution of a script every 5minutes (without being able to access cron jobs)?</p>

<p>Thanks!</p>