How to set up PHP error logging
This article will show you how to set up a PHP error log
Reviewing your PHP error logs can be useful if you want to see exactly how or why an error occurred. Simply click the relevant product from the list below and follow the provided steps to find out how to set one up.
Important: we recommend that you create a backup of your website before getting started. For details on how to do this, please read the following articles:
Web Hosting plans purchased after July 2020 / Premium Hosting plans purchased after August 2020 (cPanel)
Locate your PHP initialisation file (.user.ini)
Edit the file by placing the following sentence within it:
error_log = /home/your-username/public_html/php_error.log
Ensure that you replace the ‘your-username’ part with your actual hosting account details and that this sentence is in fact the actual path that your account uses.
Set up a file titled php_error.log in the webroot of your hosting account.
VPS Hosting
Please note: the following section was originally created for our current generation of Virtual Private Servers. As such, these instructions may not be relevant to our previous generation of Virtual Private Servers.
Find and access your PHP initialisation file (.user.ini).
Enter the following line in your file:
error_log = /your/webroot/path/php_error.log
Be sure to change /your/webroot/path to reflect the actual path that exists in your server.
Once you’ve done this, save and close your file.
A new file will appear within the webroot of your account, which will be called log. Open this file to learn more about these errors.