search

Home  >  Q&A  >  body text

php parsing error cannot be displayed

I'm running ubuntu 10.04 nginx php-fpm 5.4

If I set display_errors = On in php.ini all errors will be printed. If instead I set it to off and then use ini_set('display_errors, '1'); directly in the script they also show up, but not the parsing errors, just a blank page. I also tried using error_reporting and E_STRICT but I can't find a way!

P粉237125700P粉237125700410 days ago890

reply all(2)I'll reply

  • P粉805107717

    P粉8051077172023-10-31 11:00:37

    A few years after this question was answered, here I am, but I have found a solution to this problem. For the script I'm writing, I create a second script that contains the ini_set() directive followed by the includes of the script I

    real

    am working on. This is test_run.php

    reply
    0
  • P粉238355860

    P粉2383558602023-10-31 10:29:23

    If you disable display_errors in php.ini and then enable it in a PHP script using ini_set(), it will only execute Enabled after the line containing the ini_set() call.

    Parse Error Occurs before the PHP script is started - while parsing the PHP file (hence the term "parse error") .

    This means they occur before your ini_set() even has a chance to be executed - which means, in your case, that display_errors are not enabled when parsing Error; therefore, you won't display anything.

    reply
    0
  • Cancelreply