PHP does not display error messages
To turn on errors at the script level, include at the top of your script:
ini_set('display_errors', 1);
error_reporting(~0);
Alternatively, if it is not a production site and simply a development / testing site, you can turn on error reporting in php.ini. Search it for these settings:
error_reporting = E_ALL
;error_reporting = E_ERROR
display_errors = On
;display_errors = Off
PHP doesn't show any kind of errors
Is the display_errors
parameter listed more than once in your php.ini file? If its defined more than once, the second instance of it will override the first.
How do I get PHP errors to display?
This always works for me:
ini_set('display_errors', '1');
ini_set('display_startup_errors', '1');
error_reporting(E_ALL);
However, this doesn't make PHP to show parse errors - the only way to show those errors is to modify your php.ini with this line:
display_errors = on
(if you don't have access to php.ini
, then putting this line in .htaccess
might work too):
php_flag display_errors 1
Why in my WordPress site PHP is not showing any error message
Not sure what your problem is.
If you've just changed setting in php.ini file, make sure that you restarted Apache.
To test your setting, you can trigger an error. E.g: add trigger_error("Something goes wrong here");
in your index.php file.
Or, in case you want to use WP DEBUG, you can take a look here
PHP not displaying errors even though display_errors = On
You also need to make sure you have your php.ini
file include the following set or errors will go only to the log that is set by default or specified in the virtual host's configuration.
display_errors = On
The php.ini
file is where base settings for all PHP on your server, however these can easily be overridden and altered any place in the PHP code and effect everything following that change. A good check is to add the display_errors
directive to your php.ini
file. If you don't see an error, but one is being logged, insert this at the top of the file causing the error:
ini_set('display_errors', 1);
error_reporting(E_ALL);
If this works then something earlier in your code is disabling error display.
PHP won't show any errors
ini_set('display_errors', 1);
Do note though that if you do this in the file that has the syntax error, it won't work, as it'll never get executed then. You can also set this true in php.ini (not recommended for production servers), or if you use Apache, in .htaccess with:
php_flag display_errors 1
PHP Errors are not showing up in the browser
I found the problem. Actually, PHP is installed with XDebug extension. So the problem is in that extension. Even i was not aware of that. Because this system was used by someone previously. I uninstalled and installed again with new supported version. It works now. Thanks and sorry for the inconvenience friends.
PHP command line run does not show errors
To override display_errors=Off
in php.ini, add a -d
flag to the command line:
php -d display_errors=on script.php
Or just edit the ini and turn the flag on.
Related Topics
How to Enable PHP's Openssl Extension to Install Composer
How to Write a Stored Procedure Using PHPmyadmin and How to Use It Through PHP
Yosemite/El Capitan PHP-Gd + Mcrypt Installation
Laravel Eloquent Sum of Relation's Column
Best Way to Determine If a Url Is an Image in PHP
How to Use PHP to Check If a Directory Is Empty
Codeigniter - How to Catch Db Errors
Reconstruct/Get Source Code of a PHP Function
Adding Attributes to Customer Entity
Cakephp 2.0 - How to Make Custom Error Pages
Include Constant in String Without Concatenating
Laravel Model with Two Primary Keys Update
How to Extract Links and Titles from a .HTML Page