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…
- Login to your FTP account.
- Navigate to the /logs directory.
- Create a new file called: php.log
- Save the php.log file.
- Navigate to the /web directory.
- Create a new file called: .user.ini
- Enter the following text into the .user.ini file and save.
- Replace /fullpath/www.domain.com/ with the document root path for your site. Please see below for details on locating the correct document path to enter for your site.
log_errors = On
error_log = /fullpath/www.domain.com/logs/php.log
display_errors = Off
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.
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.