Reputation: 197
I am trying to disable STRICT Error reporting in WordPress 3.7 via my php.ini file after updating my computer to OS X 10.9. I am running PHP Version 5.4.17, the one that ships with Mavericks.
In my wp-config.php file, I have enabled define('WP_DEBUG', true);
which was on a working fine before upgrading my OS and as a result, PHP.
In the php.ini file, I have tried setting error_reporting to:
error_reporting = E_ALL
or
error_reporting = E_ALL & ~E_STRICT
or
error_reporting = E_ALL & ~E_DEPRECATED
even
error_reporting = 0
But the errors still appear.
display_errors is set to Off:
display_errors = Off
After each change to the file, I am restarting apache and httpd with these two commands:
httpd -k restart
apachectl restart
The php.ini file I am editing is the same one being pointed to in phpinfo() AND just to make sure changes are going through, I have been editing the error_prepend_string value:
error_prepend_string = "<span style='color: #ff0000'>ERROR: "
and those changes are coming through in the error.
Any thoughts on how to debug this would be much appreciated.
Upvotes: 9
Views: 10708
Reputation: 361
If you set WP_DEBUG to 'false' in wp-config.php file. These do not affect your website.
Bot the problem is that above does not work sometime. That can happen on cheap/shared hostings that force displaying PHP ERRORS, warnings and notices. In that case, you can remove this line from your wp-config.php file:
define('WP_DEBUG', false);
and place this:
ini_set('log_errors','On');
ini_set('display_errors','Off');
ini_set('error_reporting', E_ALL );
define('WP_DEBUG', false);
define('WP_DEBUG_LOG', true);
define('WP_DEBUG_DISPLAY', false);
in my case its working.
Upvotes: 0
Reputation: 369
In Wordpress 3.7, the function wp_debug_mode
(defined in wp-includes/load.php
, and called from wp-setings.php
) sets error_reporting( E_ALL )
.
Since wp-settings.php
is itself loaded at the end of wp-config.php
, you cannot change this setting from wp-config.php
(or rather, you can, but it will be overridden).
A solution is to create a "Must Use plugin", that is to say a .php file located in the /wp-content/mu-plugins/
folder containing :
<?php
if (WP_DEBUG && WP_DEBUG_DISPLAY)
{
ini_set('error_reporting', E_ALL & ~E_STRICT & ~E_DEPRECATED);
}
Upvotes: 18
Reputation: 1
I found that only
error_reporting = off
works, as STRICT errors have become part of ALL as of PHP 5.4 which is annoying.
Upvotes: 0