Hi guys, I'm experiencing some problems with ob_* function when it runs as a cronjob:
<?php
function getLayout($file, $extract=array()) {
if (is_file($file)) {
if (count($extract) > 0) {
extract($extract);
}
ob_start();
include $file;
$contents = ob_get_contents();
ob_end_clean();
return $contents;
}
return false;
}
file_put_contents('somecachefile.html', getLayout('somefile.php', array('var1'=>$val1, 'var2'=>$val2)));
?>
The cronjob is setup like this: (runs every minute)
* * * * * /usr/bin/php /path/to/cron.php > /dev/null
In this case nothing happen but the cron really ran.
If i call this (/usr/bin/php /path/to/cron.php) from the command line everything is working as expected.
Any ideas where i make a mistake???
Thanks for the help upfront!