I’m using a method outline by gregor (Create cronjob with Zend Framework) to create command line execution for parts of my application such as cron jobs, admin tasks, and the like. It works, however, no errors get reported when I create a new object that has not been defined (misspelling) and other such mistakes.
I would have thought that php would report an error, but it fails silently. What is the reason for this? Is there a better way to achieve my goal? Or how can I implement this so that I can see errors?
Many thanks!
Here is the code:
in public/index.php
if(!defined('RUN_APP') || RUN_APP == true)
{
$application->bootstrap()->run();
}
application/cron.php
define("RUN_APP",false);
require(realpath('/var/www/domain/public/index.php'));
$application->bootstrap();
//the rest
I figured it out. I’ll answer in case someone else is looking. I’m not sure why this is so but, putting:
at the top of your “cron.php” file does the trick. I guess you could throw a:
in for good measure. The puzzling thing is that I get these errors when not using the command line and I do not have the above lines in my index.php or bootstrap.php. So they are being set somewhere else in the zend framework. Perhaps “phpSettings.display_errors = 1” in bootstrap has something to do with it.