How do I get PHP Errors to display?

Discussion in 'Programming/Scripts' started by futureman, Feb 26, 2016.

  1. futureman

    futureman Banned

    I have checked my PHP ini file and display errors is set and also error reporting is E_ALL. I have restarted my apache web server. I have even put these lines at the top of my script and it doesn't even catch simple parse errors. For example, I declare variables with a "$" and I don't close statements ";". But all my scripts show a blank page on these errors, but i want to actually see the errors in my browser output.

    error_reporting(E_ALL);
    ini_set('display_errors',1);
    What is left to do?
    =================================================
    instamate review
    salesenvy review
    honest product review
     
    Last edited: Feb 29, 2016
  2. sjau

    sjau Local Meanie Moderator

    Code:
    ini_set('display_errors', 1);
    ini_set('display_startup_errors', 1);
    error_reporting(E_ALL);
    
    and in the php.ini
    Code:
    display_errors = on
    
     
    futureman likes this.
  3. futureman

    futureman Banned

    Oh, thanks sjau, It's done :)
     
  4. MaxT

    MaxT Active Member

    That's the config per user or the global one?
     
  5. sjau

    sjau Local Meanie Moderator

    if you have multi user setup you may not want to set it globally.
     
  6. Oliviamaya

    Oliviamaya Banned

    This is how you can enable displaying error in PHP.
    error_reporting = E_ALL
    display_errors = On
     
  7. MaxT

    MaxT Active Member

    I thought the same. However, even without setting errors insidet/etc/php5/cgi/php.ini, still I cannot see php errors per user.
    I don't know what happens.

    I don't want to duplicate threads. It was my question in: https://www.howtoforge.com/community/threads/cannot-set-php-user-ini-per-user.72809/

    Should I modify the ISPC php-cgi definition for every site? .
    Please, Do you know what's the right way?

    any help would be appreciated!
     
  8. Simoh

    Simoh New Member

    MaxT likes this.
  9. <?php
    //Turn Off all error reporting

    error_reporting(0);

    // Report simple running errors
    error_reporting(E_ERROR | E_WARNING | E_PARSE);

    // Reporting E_NOTICE can be good too (to report uninitialized
    // variables or catch variable name misspellings ...)
    error_reporting(E_ERROR | E_WARNING | E_PARSE | E_NOTICE);

    // Report all errors except E_NOTICE
    error_reporting(E_ALL & ~E_NOTICE);

    // Report all PHP errors (see changelog)
    error_reporting(E_ALL);

    // Report all PHP errors
    error_reporting(-1);

    // Same as error_reporting(E_ALL);
    ini_set('error_reporting', E_ALL);

    ?>
     

Share This Page