Chat with us, powered by LiveChat How to turn on PHP error logging -

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.

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

  • Site wide 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.
  2. Navigate to the /logs directory.
  3. Create a new file called: php.log
  4. Save the php.log file.
  5. Navigate to the /web directory.
  6. Create a new file called: .user.ini
  7. Enter the following text into the .user.ini file and save.

  8. log_errors = On
    error_log = /fullpath/
    display_errors = Off

  9. Replace /fullpath/ with the document root path for your site. Please see below for details on locating the correct document path to enter for your site.

Finding your document root path

You’ll find the document root path for your site by going to the hosting section of your LCN account, select ‘manage site’ and the document root path will be listed under ‘Site Summary’ on the following page.

For sites on WordPress hosting plans this path will not be listed on your account – please contact the support team if you need to confirm the document root path for your site.

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