How to display PHP errors in code output?

后端 未结 3 2061
离开以前
离开以前 2020-12-03 00:59

When executing a PHP page through browser , we will just get the output but not the errors in code.

how can i view the errors occurred by the code in the backend??

相关标签:
3条回答
  • 2020-12-03 01:40

    Try -1. From the documentation, "Passing in the value -1 will show every possible error, even when new levels and constants are added in future PHP versions."

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

    If that doesn't work, try to do an ini_set:

    // Same as error_reporting(E_ALL);
    ini_set('error_reporting', E_ALL);
    
    0 讨论(0)
  • 2020-12-03 01:59
    ini_set('display_errors', 1);
    error_reporting(E_ALL ^ E_NOTICE);
    
    0 讨论(0)
  • 2020-12-03 02:00

    Inside your php.ini, set the display_errors to On:

    display_errors = On
    

    Then restart your web server.

    0 讨论(0)
提交回复
热议问题