Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision | |||
litespeed_wiki:php:enable-php-error_log [2018/07/06 13:15] Jackson Zhang [How to enable php error log?] |
litespeed_wiki:php:enable-php-error_log [2018/07/06 13:44] Lisa Clarke Proofreading |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== How to enable php error log? ====== | + | ====== 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. | + | 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 configure this on ''php.ini'' directly. |
- | ===== viewing PHP errors that occur while running your website ===== | + | ===== Displaying on Website ===== |
- | Error reporting enabled to specifically report all errors, but not notices: | + | For viewing errors on the website front end, you can add the following to ''php.ini''. |
- | ; - Show all errors, except for notices | + | |
- | ; | + | Specify which errors to show. All errors, but not notices: |
error_reporting = E_ALL & ~E_NOTICE | error_reporting = E_ALL & ~E_NOTICE | ||
- | ; | + | or all errors, //including// notices: |
- | + | ||
- | or all errors: | + | |
error_reporting = E_ALL | error_reporting = E_ALL | ||
- | Display errors: | + | Next, specify that you want errors to be displayed: |
display_errors = On | display_errors = On | ||
| | ||
- | ===== enable error logging to write the errors to a specified file ===== | + | ===== Writing to File ===== |
+ | To write the errors to a specified file, you can add the following to ''php.ini''. | ||
- | You can set the following line of code to On to log errors or Off to turn error logging off. | + | Set the following line of code to ''On'' to log errors, or ''Off'' to turn error logging off: |
log_errors = On | 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. | + | Next, save errors from any page to a specific location, ''error_log'' in the document root, in this example. |
- | ; Log errors to specified file. | + | |
error_log = error_log | error_log = error_log |