Zend Framework 命令行查看错误
我正在使用 gregor 的方法大纲(使用 Zend Framework 创建 cronjob)来创建我的应用程序的某些部分(例如 cron 作业、管理任务等)的命令行执行。然而,它有效,当我创建一个尚未定义的新对象(拼写错误)和其他此类错误时,不会报告任何错误。
我本以为php会报错,但是它默默地失败了。这是什么原因呢?有更好的方法来实现我的目标吗?或者我该如何实现这个以便我可以看到错误?
非常感谢!
这是代码:
在 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'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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我想通了。如果其他人正在寻找,我会回答。我不确定为什么会这样,但是,将:
放在“cron.php”文件的顶部就可以了。我想你可以添加一个:
作为更好的衡量标准。令人费解的是,当我不使用命令行时,我会收到这些错误,并且我的 index.php 或 bootstrap.php 中没有上述行。所以它们被设置在 zend 框架的其他地方。也许引导程序中的“phpSettings.display_errors = 1”与此有关。
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.