3

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.

웃웃웃웃웃
  • 11,829
  • 15
  • 59
  • 91
Rohit Londhe
  • 49
  • 1
  • 1
  • 5
  • Make sure it's `Configure::write('debug', 0)` in core.php file. – Rikesh Dec 20 '13 at 06:44
  • @Rikesh Yes, debug is set 0 still getting the notices. Code stopped working when notice is shown. Version of cakePHP is 2.3.7. – Rohit Londhe Dec 20 '13 at 06:56
  • Please check your php version on live and on staging server , i think there is PHP version issue . please see this link http://stackoverflow.com/questions/18623774/cakephp-application-displays-syntax-error-unexpected – Siraj Khan Dec 20 '13 at 06:59

5 Answers5

6

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.

Siraj Khan
  • 2,328
  • 17
  • 18
3

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

ceekay
  • 151
  • 2
  • 6
2

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),
Ivan
  • 34,531
  • 8
  • 55
  • 100
1

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);
Manish Patel
  • 1,877
  • 1
  • 14
  • 15
0

Try this in config/app.php file:

'Error' => [
        'errorLevel' => E_ALL & ~E_USER_DEPRECATED & ~E_NOTICE & ~E_WARNING,
        ......
        ......
],
asmmahmud
  • 4,844
  • 2
  • 40
  • 47