Turn off notices in cakePHP
Solution 1
You can disable the debug feature by turning debug to 0 in the app\Config\core.php file
Configure::write('debug', 0);
If still you get the same issue so please check your live server Php version and also check the same on development server, I think there is php version compatibility issue so please see link http://bakery.cakephp.org/articles/markstory/2013/07/05/cakephp_2_3_7_2_4_0-beta_released
Hope it should work for you.
Solution 2
In the core.php file in /app/config, find this line and edit the level of errors you want to show:
Configure::write('Error', array(
'handler' => 'ErrorHandler::handleError',
'level' => E_ALL & ~E_DEPRECATED,
'trace' => true
));
You may now add or remove the error levels as given on this page: http://php.net/manual/en/function.error-reporting.php
Solution 3
Open config/core.php
- 0: No error messages, errors, or warnings shown. Flash messages redirect. *
- Development Mode:
- 1: Errors and warnings shown, model caches refreshed, flash messages halted.
- 2: As in 1, but also with full debug messages and SQL output.
seach this
Configure::write('debug', 0);
Solution 4
You are getting warnings and notice just because your DEBUG is TRUE. to solve this probem.
Go to config/app.php
and just change true to false as done below..
Find this line
'debug' => filter_var(env('DEBUG', true), FILTER_VALIDATE_BOOLEAN),
And change above line to
'debug' => filter_var(env('DEBUG', false), FILTER_VALIDATE_BOOLEAN),
Rohit Londhe
Updated on June 04, 2022Comments
-
Rohit Londhe almost 2 years
I am new with cakePHP. I facing issue with notice on live server. I want to suppress or turn off these notices. I have tried adding,
error_reporting(E_ALL ^ E_NOTICE ^ E_WARNING ^ E_DEPRECATED);
in the index.php file in main folder. Also added same in bootstrap.php file but no luck. Can anybody suggest me how I can do this.
-
Tomas Gonzalez about 6 yearsFor CakePHP v3.6 you have to use
'errorLevel' => E_ALL ^ E_USER_DEPRECATED,
-
Finlay Roelofs about 5 yearsAlternatively, just set the
DEBUG=false
in the.env
file