This is an old revision of the document!


How to enable php error log?

There are two methods for viewing PHP errors that occur while running your website. You can either display errors directly on your website (viewable from any web browser) or enable error logging to write the errors to a specified file (viewable inside a text file). You can change the value on php.ini directly.

Error reporting enabled to specifically report all errors, but not notices:

;   - Show all errors, except for notices
;
error_reporting = E_ALL & ~E_NOTICE
;

or all errors:

error_reporting = E_ALL

Display errors:

display_errors = On

You can set the following line of code to On to log errors or Off to turn error logging off.

log_errors = On

Next, you can save errors from any page in your files to a specific location by specifying the error_log. The following will write all errors to the error_log file inside document root.

; Log errors to specified file.
error_log = error_log
  • Admin
  • Last modified: 2018/07/06 13:15
  • by Jackson Zhang