Reputation: 5108
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.
Upvotes: 10
Views: 21184
Reputation: 1
I'm also on Linux and encountered the same problem. Enabling error reporting in php.ini didn't display errors. However, restarting the Apache server with the following command resolved the issue:
sudo systemctl restart httpd
After that errors showing up!
Upvotes: 0
Reputation: 632
I know its an old thread , yet if someone is facing the same issue with php8 installation , use the following methods .
<?php
phpinfo()
?>`
and you can find the location of php.ini in the phpinfo() page , php8 when i installed i had three directories inside /etc/php/ location 7.2 , 8.0 , 8.1 .I was using ubuntu 18.04. Run this command to find php.ini location php -i | grep "php.ini" .Try editing the php.ini in the shown location and if it does not work , follow phpinfo() page and find the php.ini location in the page.
if you have added the following script
<?php
error_reporting( E_ALL );
ini_set( "display_errors", 1 );
require_once("sample.php");
?>
and you are able to see the error means something is overriding the php.ini. Most likely in that case php.ini file location may be different. You might have edited the wrong php.ini file.I had to edit php.ini file in this location /etc/php/8.0/apache2. Change display_errors directive to on in the php.ini file.
Upvotes: 0
Reputation: 1554
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.
Upvotes: 2
Reputation: 8020
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? )
Upvotes: 8
Reputation: 5108
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.
Upvotes: 2