简体   繁体   中英

Outputting PHP Error Messages to Command Line

Where would I modify PHP or my script so that PHP errors are printed to the console in the event of an error? I can check my error log, but frequently a script I write will fail silently, and I won't know that it has unless I check the log.

This can be a problem when, for example, generating a result set where many of the results aren't being generated because the script is failing.

Would I put something in my script, something like this:

error_reporting($value);

Or is it something else entirely?

In addition to setting error_reporting() , you may need to enable display_errors .

ini_set('display_errors', '1');

Read the documentation to pass the proper value for your version of PHP. Do not leave this on in production.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM