How to turn on PHP error logging

Encountering PHP errors is fairly common when using content management systems (CMS) such as WordPress and Joomla, due to third-party plugins and themes being installed and frequently updated. To help diagnose these errors you can use PHP error logging.

Whilst these plugins are usually tested locally, they can conflict with others once live. PHP errors can cause the following issues: 

  • Sitewide warnings or errors 
  • Slowness on the front and backend of the CMS 
  • 500 & 503 errors 
  • Restricted access to your control panel  

To determine the cause of these symptoms, we’d advise turning on PHP error logging to help investigate the cause of the issue. This can be done by following the steps below. 

Please note: before you start, you’ll need to know your FTP login details and have an FTP client. If you have not accessed your FTP before, this guide will show you how.  

Let’s get started… 

  1. Login to your FTP account. 
  1. Navigate to the /logs directory. 
  1. Create a new file called: php.log 
  1. Save the php.log file. 
  1. Navigate to the /web directory. 
  1. Create a new file called: .php.ini 
  1. Enter the following text into the .php.ini file and save. 
log_errors = On
error_log = /var/www/logs/php.log
display_errors = Off

That’s it! You’ve now successfully turned on PHP error logging. 

Please Note: To view any PHP errors, navigate to the /logs directory and open the php.log file. These logs usually indicate the file path of the error; which should help to narrow down any specific plugins or themes causing PHP errors. It advised that you only turn on PHP error logging when it is needed and remove any unneeded logs once you are finished. 

Was this article helpful?

Check out some of our related guides

Need a hand? Search over a hundred step-by-step support guides