Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PHP Errors are not showing up in the browser

Tags:

php

ini

I am facing a strange problem. I have set up everything in php.ini file. But i can't get any errors showing up in the browser. I googled to set up the .ini file and did all the required things. But still i am not able to get error message displaying in the browser. My PHP ini settings,

display_errors = On
display_startup_errors = On
error_reporting = E_ALL | E_STRICT
log_errors = On
track_errors = On

I tried with the following code to see error message,

<?php
      require_once("sample.php");
 ?>

Actually the file sample is not available. So it must show Fatal error. But it is showing a blank page.

Can you point me out to fix this? I don't know what i am missing here.

like image 692
Edwin Alex Avatar asked Jan 18 '13 12:01

Edwin Alex


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 show PHP errors in Chrome?

A: You can easily debug PHP in Chrome using a simple extension called PHP Console. Just install this PHP debugging tool from the Chrome web store and start logging errors, warnings, exceptions, and vars dump on your Chrome browser.

How do I force a PHP error?

Use trigger_error() after you used set_error_handler() to register your own callback function which either logs or emails the error codes to you, and echo a simple friendly message to the user. trigger_error always reports the line and file that trigger_error was called on.

How can I send error message from PHP to HTML?

To show invalid input in PHP, set the name of the input textbox which is in HTML. All the fields are first checked for empty fields and then it is validated for correctness. If all fields are correct then it shows the success message.


3 Answers

You can also add custom error reporting to your php and test with that:

<?php
    error_reporting( E_ALL );
    ini_set( "display_errors", 1 );
    require_once( "sample.php" );
?>

If you get fatals, then something is wrong with php.ini configuration ( maybe you have multiple php.ini files? ). If you still get nothing, then php can find the file ( maybe you have some redirects set up? Maybe some strange extensions? )

like image 54
Peon Avatar answered Oct 11 '22 18:10

Peon


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.

like image 42
Edwin Alex Avatar answered Oct 11 '22 18:10

Edwin Alex


Try finding these words in your php.ini file

display_errors
error_reporting

change default value of display_errors from Off to On
change default value of error_reporting from XXXX to E_ERROR | E_PARSE

Restart apache server.
Mind, It'll always show errors.

like image 30
Priya Avatar answered Oct 11 '22 17:10

Priya