10

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.

3
  • 1
    Try restarting Apache, these changes won't take effect otherwise! Commented Jan 18, 2013 at 12:34
  • Who said he was using apache :) Commented Jan 18, 2013 at 12:36
  • @fire i am using Apache and restarted many times. But no effect. Commented Jan 18, 2013 at 12:38

5 Answers 5

8

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? )

Sign up to request clarification or add additional context in comments.

1 Comment

this is a a great solution, particularly if you don't have access to php.ini
2

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.

Comments

2

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.

1 Comment

Also, in some cases fpm needs to be restarted. systemctl restart php8.2-fpm
0

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.

Comments

0

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!

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.