Disabling Strict Standards in PHP 5.4

前端 未结 5 1956
予麋鹿
予麋鹿 2020-11-28 04:18

I\'m currently running a site on php 5.4, prior to this I was running my site on 5.3.8. Unfortunately, php 5.4 combines E_ALL and E_STRICT, which m

5条回答
  •  暖寄归人
    2020-11-28 04:30

    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.

提交回复
热议问题