Enabling Error Logs

For Linux Web Hosting packages

In this article, we'll show you how to enable error logs in PHP. With the help of these logs, you can record and analyse browser or server errors much more easily.

To enable error logs, add the following lines of code to a php.ini file in the folder where you want the logs enabled:

error_reporting = E_ALL | E_STRICT;
log_errors = On;
display_errors = Off;
error_log = /homepages/27/d382162338/htdocs/php-errors.log;

Replace /homepages/27/d382162338/htdocs/ with the absolute path to the home directory on your webspace (document root).

Code Explanation
error_reporting = E_ALL | E_STRICT This line defines which errors are to be recorded. E_ALL indicates that all errors and warnings should be displayed. E_STRICT suggests code changes to ensure compatibility of the PHP code with future PHP versions.
log_errors = On Errors in the log file of the server are recorded.
display_errors = Off Errors in the browser are not displayed.
error_log = /home/d123456789/private/php-errors.log The errors are recorded in the corresponding file in the private directory.