我已经重新安装了我的系统,现在当 zf2 出现问题时,我只能在 nginx 错误日志中看到页面上的错误,php.ini 中的 display_errors On 和 display_startup_errors On 可能与我的 php-fpm 设置有关?在不在 zf2 中的简单 php 文件中,我看到了错误!
问问题
13616 次
6 回答
12
您需要在配置中启用以下选项
'view_manager' => array(
'display_not_found_reason' => true,
'display_exceptions' => true,
)
记得在生产环境中关闭它
于 2012-11-02T12:21:59.227 回答
11
ini_set('display_errors', true);
现在在我的 index.php 中显示错误
于 2012-11-02T14:02:23.190 回答
3
Zend 框架 2 将合并来自所有已加载模块的配置,因此您需要确保已在所有模块的配置文件中将 'display_exceptions'(如果该键存在)设置为 true。
'view_manager' => array(
'display_not_found_reason' => true,
'display_exceptions' => true,
)
您可以在 application.config.php 文件中查看加载了哪些模块
于 2013-08-22T04:27:01.253 回答
3
您可以将上述内容与环境检查相结合:
将此添加到您的 public/index.php 顶部:
$env = getenv('APP_ENV') ?: 'production';
if($env == "development") {
error_reporting(E_ALL | E_STRICT);
ini_set('display_errors', true);
}
而这个给你的 public/.htaccess:
SetEnv "APP_ENV" "development"
于 2014-02-25T11:36:32.737 回答
2
将此添加到您的 public/index.php
error_reporting(E_ALL | E_STRICT);
于 2012-11-02T10:43:13.033 回答
0
在我的情况下,Zend 错误和 NGinX - php5 fpm,像这样工作:
只有我输入public/index.php
(@AlloVince)
error_reporting(E_ALL | E_STRICT);
ini_set('display_errors', 1);
没有If(){...}
但是如果只是放上面的代码,显示错误,会给出这个:
Parse error: syntax error, unexpected '}', expecting ',' or ';' in /usr/local/nginx/html/ZendSkeletonApplication/module/Album/src/Album/Controller/AlbumController.php on line 12
另一件事!设置此代码:(@To Nong)
'display_not_found_reason' => true,
'display_exceptions' => true,
像module.config.php
这样:
'view_manager' => array(
'template_path_stack' => array(
'album' => __DIR__ . '/../view',
'display_not_found_reason' => true,
'display_exceptions' => true,
),
),
我在屏幕上收到错误日志的所有错误:
Fatal error: Uncaught exception 'Zend\View\Exception\InvalidArgumentException' with message 'Invalid path provided; must be a string, received boolean' in /usr/local/nginx/html/ZendSkeletonApplication/vendor/zendframework/zendframework/library/Zend/View/Resolver/TemplatePathStack.php:201 Stack trace: #0 /usr/local/nginx/html/ZendSkeletonApplication/vendor/zendframework/zendframework/library/Zend/View/Resolver/TemplatePathStack.php(149): Zend\View\Resolver\TemplatePathStack->addPath(true) #1 /usr/local/nginx/html/ZendSkeletonApplication/vendor/zendframework/zendframework/library/Zend/Mvc/Service/ViewTemplatePathStackFactory.php(38): Zend\View\Resolver\TemplatePathStack->addPaths(Array) #2 [internal function]: Zend\Mvc\Service\ViewTemplatePathStackFactory->createService(Object(Zend\ServiceManager\ServiceManager), 'viewtemplatepat...', 'ViewTemplatePat...') #3 /usr/local/nginx/html/ZendSkeletonApplication/vendor/zendframework/zendframework/library/Zend/ServiceManager/ServiceManager.php(939): call_user_func(Array, Object(Zend in /usr/local/nginx/html/ZendSkeletonApplication/vendor/zendframework/zendframework/library/Zend/ServiceManager/ServiceManager.php on line 946
我没有在系统(Ubuntu 14.04)中将配置文件触摸为 php-fpm。
于 2015-05-30T16:04:19.103 回答