1

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
Community
  • 1
  • 1
d-_-b
  • 6,555
  • 5
  • 40
  • 58

1 Answers1

0

I figured it out. I'll answer in case someone else is looking. I'm not sure why this is so but, putting:

ini_set('display_errors', 'on');

at the top of your "cron.php" file does the trick. I guess you could throw a:

error_reporting(E_ALL|E_STRICT);

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.

d-_-b
  • 6,555
  • 5
  • 40
  • 58
  • I'm having the same problem. Errors are displayed in the main commandline program, but not if they fail to instantiate a Zend Model Object. Your suggested fix does not work for me. Thanks though. – dlink Nov 20 '14 at 21:12