簡體   English   中英

層層隱藏生產服務器上的錯誤

[英]Laminas hide errors on productive server

對於我的網站,我使用 Laminas。 我在開發服務器和公共生產服務器上本地運行它。 我想向公眾隱藏錯誤,只讓它們在開發服務器上可見。 因此,我將這些行寫入 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);
}

但如果APPLICATION_ENV='productive' ,我仍然會看到錯誤消息。


我已經檢查了服務器是運行if 代碼還是else 代碼

這個問題不是關於處理錯誤,只是為了向公眾隱藏它的信息。

嘗試在生產服務器上編輯config/autoload/local.php

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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM