Question: I have a file "`update.php`" which does some MySQL operations. A cron job executes this file every 5 minutes. Unfortunately, I cannot execute the cron job more often.

So I had the idea that I could add ...

```
<html>
<head>
  <meta http-equiv="refresh"  content="2; URL=<?php echo $_SERVER['SCRIPT_NAME']; ?>" />
</head>
<body></body>
</html>

```

... to the page "`update.php`". Will cron execute the file in a way that the page will refresh automatically? Or will that not happen because there is no client with a browser?

If it the meta refresh has no effect, is there any other possibility to achieve the refreshing of the page?

Thanks in advance!

Answer: 
I'm pretty sure you can achieve it by doing this:

```
<?php

$secs = 120;

ignore_user_abort(true);
set_time_limit(0);

while (true)
{
    // do something

    // Sleep for some time
    sleep($secs);
}

?>

```

**Edit**

You will have to execute it once after every server restart unless you do it like Douglas describes.

**Update**

Keep Douglas Leeder's answer in mind, and then take a look at this:

<http://www.php.net/manual/en/function.ignore-user-abort.php>
What you are trying to do it implies user interaction, so what if no client enters into your "page"?

For example Servlets and EJB containers can do it programmatically at container startup what you need, so I suppose that for PHP the only way to accomplish "automatically" cronlike jobs is to make some changes in your Apache source code, obviously only if you are using an housing server.

**A more praticable option not contempling code changes could be some cron script calling directly your page (wget,netcat,etc...) launched during your web server startup**