CodeIgniter 4 应用程序中存在多个弃用消息和致命错误

问题描述 投票:0回答:1
Deprecated: Optional parameter $body declared before required parameter $userAgent is implicitly treated as a required parameter in C:\xampp\htdocs\e-arsip-ci4\system\HTTP\IncomingRequest.php on line 161

Deprecated: filter_var(): Passing null to parameter #3 ($options) of type array|int is deprecated in C:\xampp\htdocs\e-arsip-ci4\system\HTTP\Request.php on line 439

Fatal error: Uncaught ErrorException: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\e-arsip-ci4\app\Config\Events.php:33) in C:\xampp\htdocs\e-arsip-ci4\system\Debug\Exceptions.php:164 Stack trace: #0 [internal function]: CodeIgniter\Debug\Exceptions->errorHandler(2, 'Cannot modify h...', 'C:\\xampp\\htdocs...', 164) #1 C:\xampp\htdocs\e-arsip-ci4\system\Debug\Exceptions.php(164): header('HTTP/1.1 500 In...', true, 500) #2 [internal function]: CodeIgniter\Debug\Exceptions->exceptionHandler(Object(ErrorException)) #3 {main} thrown in C:\xampp\htdocs\e-arsip-ci4\system\Debug\Exceptions.php on line 164

Fatal error: Uncaught ErrorException: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\e-arsip-ci4\app\Config\Events.php:33) in C:\xampp\htdocs\e-arsip-ci4\system\Debug\Exceptions.php:164 Stack trace: #0 [internal function]: CodeIgniter\Debug\Exceptions->errorHandler(2, 'Cannot modify h...', 'C:\\xampp\\htdocs...', 164) #1 C:\xampp\htdocs\e-arsip-ci4\system\Debug\Exceptions.php(164): header('HTTP/1.1 500 In...', true, 500) #2 C:\xampp\htdocs\e-arsip-ci4\system\Debug\Exceptions.php(224): CodeIgniter\Debug\Exceptions->exceptionHandler(Object(ErrorException)) #3 [internal function]: CodeIgniter\Debug\Exceptions->shutdownHandler() #4 {main} thrown in C:\xampp\htdocs\e-arsip-ci4\system\Debug\Exceptions.php on line 164

为什么程序没有运行?

php codeigniter codeigniter-4
1个回答
0
投票

您必须更改 php 配置以抑制错误输出到前端/UI。它应该只记录到文件。

php.ini.htaccess 中查找

display_errors
display_startup_errors
并将其禁用。

在您的情况下:php 解析器将 error_log 输出发送到客户端,这也强制网络服务器将响应标头发送到客户端。

这会阻止应用程序设置其最初预期的响应标头,从而导致应用程序失败。

© www.soinside.com 2019 - 2024. All rights reserved.