I want to display the notice and warning logs on the web.

Asked 1 years ago, Updated 1 years ago, 71 views

I would like to display notices and warning logs on the web in a development environment using CakePHP, but it doesn't work.

Run Environment
CakePHP 2.2
PHP 5.3

confirmed, executed
·Check with phpinfo
The display_errors item is off for Local Value and on for Master Value.

·php.ini
error_reporting=E_ALL
display_errors=On
Missing comment in the above settings

·httpd.conf
php_flag display_errors on
If you put this in the top or bottom of the conf file, no errors will be displayed

·htaccess file
I checked htaccess in the CakePHP source, but there was no description to hide PHP errors, and php_flag display_errors on did not change.

·CakePHP side
Setting the core.php DEBUG mode to 1 to 2 to 3 does not show up on the screen.
The log files under the log folder contain notices and warnings, but I want to be able to see them on the screen...

·Description in PHP file
ini_set('display_errors', 'On');
Even if you write this at the beginning of the PHP file, it does not appear on the screen.

I have checked so far, but even if it is recorded in the log file, there is no error on the screen.
I'm stuck, but I wonder if there are any other possible causes...
Thank you for your cooperation.

php cakephp

2022-09-30 21:25

1 Answers

CakePHP uses the Configure::write() method to rewrite the debug option. Also update display_errors.

CakePHP2 Series: https://github.com/cakephp/cakephp/blob/2.x/lib/Cake/Core/Configure.php#L168
CakePHP3 Series:
https://github.com/cakephp/cakephp/blob/917f876168e4b5af2a787f3d17b7659c1f4cb679/src/Core/Configure.php#L99

If Configure::write('debug', false) is mentioned, display_errors=0.

Check the config/core.php value for 2 series and debug value for 3 series.
However, other locations may have been modified by the Configure::write method.In addition, the three series relies on the environment variable DEBUG as described in the code.

Also, in the development environment, debug=true is fine, but don't forget to change it to debug=false in the production environment.


2022-09-30 21:25

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.