Here is my php.ini and I have restarted the httpd process several times while messing around with this, however no errors are being displayed, only a blank page.
error_reporting = E_ALL & E_STRICT
display_errors = On
In dev, we use this:
error_reporting = E_ALL | E_STRICT
Related
I know what the error_reporting values mean. I know -1 means "show all" and 0 means "show none".
But nowhere is specified what is the value set by default, when nothing is specified by the user.
Trying phpinfo() I see
...
Configuration File (php.ini) Path => /usr/local/etc/php
Loaded Configuration File => (none)
...
So, given there's no php.ini loaded, what is the default value/behaviour of error_reporting?
From the documentation of the config file options
The default value is E_ALL & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED. This setting does not show E_NOTICE, E_STRICT and E_DEPRECATED level errors. You may want to show them during development.
In PHP 8.0, the default changed to E_ALL. See https://php.watch/versions/8.0/error-display-E_ALL
In PHP 5.3 or newer versions but prior to PHP 8.0, the default error_reporting level was:
error_reporting = E_ALL & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED
This means that all type of errors are reported except E_NOTICE,
E_STRICT, and E_DEPRECATED.
Since PHP 8.0, the default error_reporting level is E_ALL.
error_reporting = E_ALL
Have a look: https://lindevs.com/default-error-reporting-level-is-e_all-in-php-8-0/
I know this question has been asked a kazillion times, but I've read the responses and done all suggestions. My phpinfo shows:
display_errors = off
error_reporting = 0
and I've set all of the suggestions in my config file, e.g.
define('WP_DEBUG', false);
define('WP_DEBUG_DISPLAY', false);
and yet I'm STILL getting warnings like the following:
Warning: Parameter 1 to wp_default_scripts() expected to be a reference, value given in /Users/.../wp-includes/plugin.php on line 601
Warning: Parameter 1 to wp_default_styles() expected to be a reference, value given in /Users/.../wp-includes/plugin.php on line 601
Please note, I'm using MAMP for a local server and wordpress. Also I've searched the entire site to see if WP_DEBUG is being set elsewhere and it's not.
I'm banging my head against a wall. Any ideas?
Thanks,
Heather
Which version of php and Wordpress are you running? There are several posts in the wordpress core tracker pointing similar issues with php 7.1:
https://core.trac.wordpress.org/ticket/38144
https://core.trac.wordpress.org/ticket/37772
Regarding why is WP showing this warnings although you have disabled all debug options here are some suggestions:
Search in your php.ini for something like this and comment it:
error_reporting = E_ALL & ~E_NOTICE
error_reporting = E_ALL & ~E_NOTICE | E_STRICT
error_reporting = E_COMPILE_ERROR|E_RECOVERABLE_ERROR|E_ER… _ERROR
error_reporting = E_ALL & ~E_NOTICE
Search your code for error_reporting(whatever) or ini_set('error_reporting', whatever);
Hope this helps.
I am working on project # home and using WAMP for development. Currently the php.ini file has the following lines set like this:
error_reporting = E_ALL & ~E_DEPRECATED
display_errors = On
I had hoped in doing so it would prevent deprecation warnings from showing up. However it is not. Is there a way I can adjust error_reporting to ignore deprecated warnings.
Output I am getting currently:
You can use this function :
error_reporting(E_ALL ^ E_DEPRECATED);
http://www.php.net/manual/en/function.error-reporting.php
Or use "#" operator before function name.
#mysql_connect();
In your php.ini file change the following.. (note wamp has 2 different php.ini files so make the changes on both)
from this
error_reporting = E_ALL
to this
error_reporting = E_ALL & ~E_DEPRECATED
I had the same problem. It turned out however, that I edited wrong php.ini file. In my case the correct one was
C:\wamp64\bin\php\php5.6.25\phpForApache.ini
and in this file I have changed this line to:
error_reporting = E_ALL & ~E_DEPRECATED.
It didn't make any difference what I had changed in that "obvious" php.ini file.
Set your error report to
error_reporting (E_ERROR | E_WARNING | E_PARSE | E_NOTICE);
on your php page.
If you want to show all errors except deprecated, then use this setting:
error_reporting = E_ALL ^ E_DEPRECATED
Edit: You could also create a custom error handler to hide only mysql_ deprecation warnings:
set_error_handler(function($errno, $errstr) {
return strpos($errstr, 'mysql_') === 0;
}, E_DEPRECATED);
But please note that mysql_ functions are deprecated. So instead of trying to hide the errors, consider switching to mysqli or PDO.
To hide php errors on WAMP server, Please open php.ini file and find following line of code
error_reporting = E_ALL
and replace it with
error_reporting = E_ALL & ~E_NOTICE
All errors will be hide/disable.
I have updated my PHP version 5.3 to 5.5 and currently it starts to display internal server error instead of showing errors.
My php.ini settings configurations are as below:
error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT
I have already trial-and-error'ed various options available at stack overflow:
error_reporting = E_ALL
error_reporting = E_NOTICE
error_reporting = E_ALL & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED
Try to set display_errors to On in your php.ini. See http://www.php.net/manual/en/errorfunc.configuration.php#ini.display-errors.
With reference http://www.php.net/manual/en/errorfunc.configuration.php and fnc, I have used in two ways as given below, both of them work fine at my end.
Option 1: Add the following line at the end of php.ini file or change value if it is existed as:
display_errors = On
Option 2: Change settings run time, add below line at the top of PHP script file.
<?php
if (!ini_get('display_errors')) {
ini_set('display_errors', '1');
}
?>
I'm trying to get the warnings to show in my php error log.
My ISP has some warnings showing and I need to be able to see them on my test server.
error_reporting = E_ALL & ~E_NOTICE
display_errors = off
display_startup_errors = Off
log_errors = On
error_log = "C:\php-errors.txt"
I've upgraded my php version too 5.2.17
I also have
register_globals = Off
Like my ISP, but I can't get any warnings to show.
ini_set('display_errors', 'on'); is a great way to change php configurations settings specific for that page only. Include it in a global header/initialization file to make it application specific. Also, as mentioned before error_reporting(E_ALL); is good for this too.
Code at the top your scripts:
ini_set('display_errors', 'on');
error_reporting(E_ALL);
Be sure to use these only for development environments only.
Set display_errors to On to display the warnings in the page (instead of in the logfile) and set error_reporting to E_ALL | E_STRICT to display all warnings and errors in your php.ini.
If you want to show all possible warnings, try error_reporting(-1);, or you can put error_reporting = -1 into the php.ini file on your test server. It works, because the internal variable is used as a bit-field, and -1 sets all the bits on, hence, showing all possible errors.
To make sure that the error_reporting is still set to what you think, the variable returns the currently set level.
$prevErrLevel = error_reporting(-1);
echo "errlevel was: $prevErrLevel before setting to all.", __FILE__,':',__LINE__;