40

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?

Álvaro González
  • 142,137
  • 41
  • 261
  • 360
user700792
  • 2,199
  • 5
  • 20
  • 15

5 Answers5

75

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
hakre
  • 193,403
  • 52
  • 435
  • 836
Jeff Lambert
  • 24,395
  • 4
  • 69
  • 96
11

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");
Shakti Singh
  • 84,385
  • 21
  • 134
  • 153
1

To show error message on page over browser for php script use following code in top of your php file.

<?php 
ini_set('display_errors', 1);
error_reporting(~0);
?>

and there is another way to check php error code if you are linux ubuntu user execute following command on terminal.

NOTE : -10 is the number of message you want to show.

enter image description here

Sunny S.M
  • 5,768
  • 1
  • 38
  • 38
0

You can use following code in your program

error_reporting(E_ALL);
ini_set('display_errors', '1');
Ram Choubey
  • 265
  • 2
  • 12
0

It possibly did override your settings in the php.ini. Check the php.ini for error handling parameters and make sure they're switched on.

Happened to me a few weeks ago, too

Bjoern
  • 15,934
  • 4
  • 43
  • 48