0

I have this code which should of course throw a few errors. But no errors are displayed at all, it just loads a blank page. I read PHP not displaying errors even though display_errors = On but it did not help.

<?php
    ini_set('display_errors', 1);
    error_reporting(E_ALL);

    blaswagagsd
    gfdasgyoloeaifs

    echo $_SERVER['SERVER_SOFTWARE'] sdfga
?>

/etc/php5/apache2/php.ini

display_errors = On
;   Default Value: On
;   Development Value: On
;   Production Value: Off

error_reporting = E_ALL
;   Default Value: E_ALL & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED
;   Development Value: E_ALL
;   Production Value: E_ALL & ~E_DEPRECATED & ~E_STRICT

I also set the same settings in /etc/php5/cli/php.ini. Of course I restarted Apache after I changed the php.ini. What else can I try?

11
  • check phpinfo() and make sure those are the proper .ini files. and check for php_value directives in .htaccess files, other apache .conf files, which can override the .ini settings. Commented Nov 10, 2015 at 14:18
  • There are multiple .htaccess files, how can i find out which is the right one? It found: ./usr/share/doc/debian-reference-common/html/.htaccess ./usr/share/phpmyadmin/setup/lib/.htaccess ./usr/share/phpmyadmin/setup/frames/.htaccess ./usr/share/phpmyadmin/libraries/.htaccess Commented Nov 10, 2015 at 14:22
  • 1
    create your .htaccess file in your project. Commented Nov 10, 2015 at 14:24
  • 1
    @Paladin76 PHP documentation states Although display_errors may be set at runtime (with ini_set()), it won't have any effect if the script has fatal errors. This is because the desired runtime action does not get executed. (which is fairly obvious), so the in-script settings wont apply here anyways. And nope, the numeric 1 is correct here. Commented Nov 10, 2015 at 14:30
  • 1
    The .htaccess in your files' directory should contain two lines: php_value display_errors = On and php_value error_reporting = E_ALL. Could you try that? Commented Nov 10, 2015 at 14:33

1 Answer 1

0

I solved it, the problem was that there is another "display_errors" somewhere on the bottom of the php.ini, which set display_errors = Off, so changing the first occurence of "display_errors" CAN'T work. Either set this display_errors to On or delete the line. I am wondering why the original creators of php.ini set this trap.

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

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.