For a cronjob I use php's exec. For sure, sometimes include is better (or at least more simple), but not if you start a few things at the same time - and from time to time that's necessary.
Anyway, on the server from my webhoster I have PHP 5.3 - and everyhting works fine! But not on the server for a client, which is using PHP 5.2.7. I don't know if this version is the problem, but I think it's better to mention that.
I have (e.g.) two files in the same directory: cronjob.php and test.php. The last one executes its content by starting the file via webbrowser. But not, if I try to execute it by the different file.
cronjob.php:
<?php
exec('php test.php > /dev/null &');
?>
The webhoster of my client (not the one I use) told me to add the full path to the php and to add php45, otherwise it would execute "in php 4". So I changed it to:
exec('/usr/local/bin/php54 absolutepath2file/test.php > /dev/null &');
...but again, it doesn't start the test.php.
I know, if you start a cronjob directly by server and not as a url it won't execute every runtime environment, but the script is loaded directly with url. AND that's exactly the same result if you open the file via your webbrowser.
The strange thing is, that the webhoster told me by mail, that the cronjob.php starts correctly the test.php... but it won't execute. And to repeat: test.php will work perfectly if you start it manually.
Could be there a problem with safe_mode (<- php 5.2.7)? I also add error_reporting(E_ALL); to get alle possible errors, but there aren't any issues, says the server error log.
Anybody? :-)