简体   繁体   English

层层隐藏生产服务器上的错误

[英]Laminas hide errors on productive server

For my website, I use Laminas.对于我的网站,我使用 Laminas。 I run it locally on a development server and on a public productive server.我在开发服务器和公共生产服务器上本地运行它。 I want to hide errors to the public and only let them be visible on the dev server.我想向公众隐藏错误,只让它们在开发服务器上可见。 Therefore I wrote these lines into the public/index.php file:因此,我将这些行写入 public/index.php 文件:

if(apache_getenv('APPLICATION_ENV')=='development'){
    error_reporting(E_ALL);
    ini_set('display_errors', 1);
    ini_set('display_startup_errors', 1);
}else{
    error_reporting(0);
    ini_set('display_errors', 0);
    ini_set('display_startup_errors', 0);
}

I but error messages still get seen if APPLICATION_ENV='productive' .但如果APPLICATION_ENV='productive' ,我仍然会看到错误消息。


I already checked wheter the server runs the if code or else code .我已经检查了服务器是运行if 代码还是else 代码

This question is not about handling an error, just to hide it's message to the public.这个问题不是关于处理错误,只是为了向公众隐藏它的信息。

try to edit config/autoload/local.php on your production server尝试在生产服务器上编辑config/autoload/local.php

'view_manager' => array(
    'display_exceptions' => false
)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM