Turn off deprecated errors php 5.3

2019-01-13 07:07发布

My server is running php 5.3 and My wordpress install is spitting these errors out on me causing the my session_start() to break.

Deprecated: Assigning the return value of new by reference is deprecated in /home//public_html/hub/wp-settings.php on line 647

Deprecated: Assigning the return value of new by reference is deprecated in /home//public_html/hub/wp-settings.php on line 662

Deprecated: Assigning the return value of new by reference is deprecated in /home//public_html/hub/wp-settings.php on line 669

Deprecated: Assigning the return value of new by reference is deprecated in /home//public_html/hub/wp-settings.php on line 676

Deprecated: Assigning the return value of new by reference is deprecated in /home//public_html/hub/wp-settings.php on line 712

This is annoying, but I do not want to turn off on screen error reporting. How do I disable these bothersome deprecated warnings?

I am running Wordpress 2.9.2.

10条回答
Luminary・发光体
2楼-- · 2019-01-13 07:26

In file wp-config.php you can find constant WP_DEBUG, make sure it is set to false.

define('WP_DEBUG', false);

This is for wordpress 3.x

查看更多
我想做一个坏孩纸
3楼-- · 2019-01-13 07:26

this error occur when you change your php version: it's very simple to suppress this error message

To suppress the DEPRECATED Error message, just add below code into your index.php file:

init_set('display_errors',False);

查看更多
Lonely孤独者°
4楼-- · 2019-01-13 07:30

You can do it in code by calling the following functions.

error_reporting(E_ERROR | E_WARNING | E_PARSE | E_NOTICE);

or

error_reporting(E_ALL ^ E_DEPRECATED);
查看更多
迷人小祖宗
5楼-- · 2019-01-13 07:34

You have to edit the php configuration file. Fin the line

error_reporting = E_ALL

and replace with error_reporting = E_ALL ^ E_DEPRECATED

If you don't have access to the configuration file you can add this line to the php wordpress file (maybe headers.php)

error_reporting(E_ALL ^ E_DEPRECATED); 
查看更多
登录 后发表回答