How to Enable or Disable PHP Error Logging in cPanel?

How to Enable or Disable PHP Error Logging in cPanel?

PHP error logging is a powerful tool that empowers website owners and developers with valuable insights into the health and performance of PHP applications. In any case, when errors occur within PHP scripts, whether due to minor warnings or critical failures, logging captures these events, helps in diagnosing issues and ensures smoother website operation. 

However, configuring error logging within the cPanel environment may not always be straightforward for users unfamiliar with PHP settings. In this article, we aim to simplify the process by providing clear instructions on how to enable or disable PHP error logging via cPanel, empowering users to manage and troubleshoot their web applications effectively.

Let’s get started!

Steps to Enable or Disable PHP Error Logging in cPanel

➔ Log into your cPanel account.

Login to cPanel

➔ On the cPanel’s dashboard, navigate to the ‘Software’ section.

Select Software option

➔ To do that, you have to click on ‘Select PHP Version.’

click on ‘Select PHP Version

➔ After that, you have to click on the ‘Switch to PHP Options’ link at the top-right corner of the page, which will take you to a page where changing various PHP settings is possible.

click on the ‘Options’ link

➔ On that page, scroll through the list of PHP options until you find ‘log_errors.’ 

  •  If you want to enable error logging, click on the value next to ‘log_errors’ and change it to ‘On.’
    log_errors and change it to On
  •  If you want to disable error logging, click on the value next to ‘log_errors’ and change it to ‘Off.’

log_errors and change it to Off

➔ Look for the ‘error_log’ option. Here, you can specify the file path where the error logs will be saved. If not specified, PHP will use the default server path. Setting a custom file path to keep your logs organized is often useful.

  •  Click on the value next to ‘error_log’ and enter the desired path, such as/home/yourusername/public_html/php_errors.log’

➔ After adjusting the ‘log_errors’ and ‘error_log’ settings, click the ‘Save’ button to apply your changes.

Conclusion

As you checked, enabling PHP error logging through cPanel is straightforward and can significantly aid in debugging PHP applications. Following the abovementioned steps, you can toggle PHP error logging and set a custom log file path as needed. 




Share on Pinterest
Share on LinkedIn
Share on WhatsApp
Share on Telegram