简体   繁体   English

php错误和流明错误都显示在错误输出上

[英]php error and lumen error both showing on error output

How can I fix this issue in lumen framework ?如何在流明框架中解决此问题?

I am getting the PHP default errors and lumen framework exception both at the same time.我同时收到 PHP 默认错误和 lumen 框架异常。

Here I have attached the screenshot of both files.在这里我附上了两个文件的截图。 The output and the exception handler PHP file.输出和异常处理程序 PHP 文件。

异常或错误的输出

流明异常/handle.php 文件

Oh... You need to try any of the following:哦...您需要尝试以下任何一项:

Method 1方法一

Assuming you are running apache web server and php 7.2 on an Ubuntu PC.假设您在Ubuntu PC 上运行apache Web 服务器和php 7.2 Go to your php.ini file ( /etc/php/7.2/apache2/php.ini ), search for display_errors and set it to Off .转到您的php.ini文件( /etc/php/7.2/apache2/php.ini ),搜索display_errors并将其设置为Off

If Method 1 doesn't fix it for you, try Methods 2 :如果方法 1不能为您修复它,请尝试方法 2

Method 2方法二

Go to the index.php inside the public folder of your app and turn off display_errors like so:转到app public文件夹内的index.php并关闭display_errors如下所示:

ini_set('display_errors', 0);   //Set this before $app->run();

To display the comprehensive error, I added the following configurations.为了显示综合错误,我添加了以下配置。

config/app.php配置/app.php

return [
    'debug' => (bool) env('APP_DEBUG', true),
    'env' => env('APP_ENV', 'production'),    
];

.env .env

APP_ENV=local
APP_DEBUG=true

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

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