Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PHP does not display error messages

I installed XAMPP 1.7.4 (with PHP 5.3.5), the problem is PHP does not display any error messages. E.g. if I connect to MYSQL with mysql_connect() without parameters, PHP will not complain about the required fields.

Why is this?

How can I configure PHP to display errors?

like image 993
user700792 Avatar asked Apr 15 '11 18:04

user700792


People also ask

Why does PHP not show errors?

If your PHP script is halting (or not executing code like you expect) and not displaying any error messages even though you know there's an error happening, it's likely that the 'display_errors' configuration setting is switched off.

How do I view PHP error logs?

Look for the entry Configuration File (php. Find the Error handling and logging section of the php. ini file. Make sure that both display_errors = On, display_startup_errors = On and log_errors = On are present and uncommented. Check the value of error_log - this tells you the location of the file errors are logged to.

Which of the following PHP directive is used to display all the errors except notices?

error_reporting: It displays all level errors except E-NOTICE, E-STRICT, and E_DEPRECATED level errors. display_errors: By default, the value of display_errors is off.


2 Answers

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 
like image 126
2 revs, 2 users 91% Avatar answered Oct 18 '22 23:10

2 revs, 2 users 91%


May be the display error is off

add in .htaccess file of your application.

php_value display_errors on 

OR

use this at the top of your php script

ini_set('display_errors',"1"); 
like image 24
Shakti Singh Avatar answered Oct 18 '22 23:10

Shakti Singh