How to Eliminate PHP5 Strict Standards Errors

How to eliminate php5 Strict standards errors?

One of the changes in php 5.4 is that E_STRICT is now part of E_ALL

So, in your /cake/bootstrap.php you could remove the E_STRICT from your error reporting:

error_reporting(E_ALL ^ E_STRICT);

and be compatible again with before 5.4 versions.

PHP 5 disable strict standards error

Do you want to disable error reporting, or just prevent the user from seeing it? It’s usually a good idea to log errors, even on a production site.

# in your PHP code:
ini_set('display_errors', '0'); # don't show any errors...
error_reporting(E_ALL | E_STRICT); # ...but do log them

They will be logged to your standard system log, or use the error_log directive to specify exactly where you want errors to go.

Disabling Strict Standards in PHP 5.4

As the commenters have stated the best option is to fix the errors, but with limited time or knowledge, that's not always possible. In your php.ini change

error_reporting = E_ALL

to

error_reporting = E_ALL & ~E_NOTICE & ~E_STRICT

If you don't have access to the php.ini, you can potentially put this in your .htaccess file:

php_value error_reporting 30711

This is the E_ALL value (32767) and the removing the E_STRICT (2048) and E_NOTICE (8) values.

If you don't have access to the .htaccess file or it's not enabled, you'll probably need to put this at the top of the PHP section of any script that gets loaded from a browser call:

error_reporting(E_ALL & ~E_STRICT & ~E_NOTICE);

One of those should help you be able to use the software. The notices and strict stuff are indicators of problems or potential problems though and you may find some of the code is not working correctly in PHP 5.4.

XAMPP turn off Strict Standards errors

I'd change this line

error_reporting = E_ALL | E_STRICT

to the production Production Value

error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT

You can also change the display_errors settings which will allow you to log errors, but not display them

display_errors = Off

Strict Standards Error in CakePhp?

Seems that old CakePHP doesn't play very well with newer versions of PHP. Please have a look here: http://i.justrealized.com/2009/cakephp-php-deprecated-error-warning/

Be aware that CakePHP 1.2 is deprecated. It's recommended to use at least 1.3 if you want to stick to 1.x version, as there aren't major differences with 1.2.

But if you still insist, you can downgrade PHP to 5.2 or lower to be compatible



Related Topics



Leave a reply



Submit