![]() |
Fatal Error When Set CI_DEBUG to False On Production Mode Codeigniter 4 - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28) +--- Forum: CodeIgniter 4 Support (https://forum.codeigniter.com/forumdisplay.php?fid=30) +--- Thread: Fatal Error When Set CI_DEBUG to False On Production Mode Codeigniter 4 (/showthread.php?tid=83548) |
Fatal Error When Set CI_DEBUG to False On Production Mode Codeigniter 4 - dennz.liu - 10-01-2022 Why I get this error when set from Config/Boot/production.php CI_DEBUG to false in production mode ? this is the default setting from CI4. Code: defined('CI_DEBUG') || define('CI_DEBUG', false); Code: Fatal error: Declaration of CodeIgniter\Log\Logger::emergency($message, array $context = []): bool must be compatible with Psr\Log\LoggerInterface::emergency(Stringable|string $message, array $context = []): void in E:\testing\Source Code\testing_CI_v.4.2.6\system\Log\Logger.php on line 157 For Development And Testing Mode run without problem. This error just occur when using routes->resource (RESTFUL API). It is not clear what error is this. I try to replace the system folder with new one. But the error still exists. It is said "Uncaught Error: Class "CodeIgniter\Log\Logger" not found" I don't know what is the problem with this and why it is not found. Now my app just run with set CI_DEBUG to true to prevent the error. But the default is set to false for production. defined('CI_DEBUG') || define('CI_DEBUG', true); What is missing in here ? It is so strange that setting the CI_ENVIRONMENT to development or testing worked without a problem. But for production not working. So I decide to turn on the error display in production mode and found the error above. Seriously need help. RE: Fatal Error When Set CI_DEBUG to False On Production Mode Codeigniter 4 - dennz.liu - 10-01-2022 I found the problem in the restful api. The problem is in the config/filter.php Code: $routes->resource('ApiManageTips', ['controller' =>'App\Controllers\ApiData\ApiManageTips']); // get, put, create, delete Code: public $filters = [ The Above example is working in the version 4.1.2 but is not working in version 4.2.6 Instead change to : Code: public $filters = [ I don't why it is not working in the CI Version 4.2.6. |