How to enable PHP error logging

If you require error logging to be enabled for your PHP based website, you will need to enable it within a .user.ini file on your domain. This is useful when troubleshooting 500 internal server errors and blank pages displayed in the browser. The below steps will explain how to enable PHP error logging within a .user.ini file.

  1. Add the following lines into an existing, or create a new .user.ini file within your domains’ public_html folder (replace ‘your_FTP_user’ with your FTP username):
log_errors = On
error_log = /usr/home/your_FTP_user/PHP_errors.log
error_reporting = 32767

Once the above has been added to the .user.ini file, you need to create the log file, e.g. PHP_errors.log in your home folder. The log file is not created automatically.

Ensure that the permissions of the PHP_errors.log file is 755 (readable and executable by everyone, but only writeable by the file/folder owner) so that the file is writable. The permissions can be changed via the konsoleH File Manager, SSH (chmod) or a capable FTP client.