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)

Step 1 of 4

Locate your PHP initialisation file (.user.ini)

 

Step 2 of 4

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.

 

Step 3 of 4

Set up a file titled php_error.log in the webroot of your hosting account.

 

Step 4 of 4

Once done, end the PHP process.

 

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.

Step 1 of 4

Find and access your PHP initialisation file (.user.ini).

Step 2 of 4

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.

Step 3 of 4

Once you’ve done this, save and close your file.

Step 4 of 4

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.