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.
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.