Error logs are essential for troubleshooting website issues, from mysterious website errors to PHP crashes and database connection problems.

This documentation will help you locate and enable error logs in cPanel and Plesk, allowing you to identify and fix problems that might otherwise remain hidden.

Whether you're running into issues with your website or simply want to monitor for potential problems, knowing how to access these logs is crucial for effective web hosting management.

Finding Error Logs in cPanel

Disclaimer: Always test these steps in a development environment first. This guide was created based on current versions of cPanel and Plesk. Please check the official documentation for the most up-to-date information as interfaces may change.

Key Terms for Beginners:

  • Error Logs: Text files that record problems, errors, and warnings that occur on your server.
  • cPanel/Plesk: Control panel software that helps you manage your hosting account without needing technical knowledge.
  • SSH: Secure Shell - a protocol that lets you connect to your server securely via the command line.
  • Terminal/Command Line: Text interface where you can type commands directly to your server.

 

How to Locate Error Logs in cPanel and Plesk

 

Method 1: Using the Error Log Interface

  1. Log in to your cPanel account.
  2. In the "Metrics" section, click on Error Log.
  3. Your most recent error logs will be displayed on this page.
  4. You can use the search function to filter specific errors.

Method 2: Using File Manager

  1. Log in to your cPanel account.
  2. In the "Files" section, click on File Manager.
  3. Navigate to the /public_html directory.
  4. Look for the error_log file (sometimes it may be hidden).
  5. If hidden files aren't visible, click on "Settings" in the top right and check "Show Hidden Files".
  6. Right-click on the file and select "View" to see the contents.

Method 3: Using SSH (Advanced)

  1. Connect to your server via SSH.
  2. Navigate to your website's root directory with: cd ~/public_html
  3. View the error log with: cat error_log or tail -f error_log for real-time monitoring.
  4. For PHP errors, check: cat /var/log/php-fpm/error.log (path may vary by server configuration).

Common cPanel Error Log Locations

  • Apache error logs: /usr/local/apache/logs/error_log
  • Domain-specific error logs: /home/username/public_html/error_log
  • PHP error logs: /var/log/php-fpm/error.log or /var/log/php-fpm/www-error.log
  • Email error logs: /var/log/exim_mainlog
  • MySQL error logs: /var/lib/mysql/hostname.err

 

Finding Error Logs in Plesk

Method 1: Using Plesk Interface

  1. Log in to your Plesk Control Panel.
  2. Click on Websites & Domains.
  3. Select the domain you want to check.
  4. Click on Logs in the right sidebar.
  5. You can view different types of logs including:
    • Web server access logs
    • Web server error logs
    • FTP logs
    • PHP error logs

Method 2: Using File Manager

  1. Log in to your Plesk Control Panel.
  2. Click on Files in the left navigation.
  3. Navigate to /var/www/vhosts/yourdomain.com/logs.
  4. Look for files named error_log, proxy_error_log, or similar.
  5. Click on the file to view its contents.

Method 3: Using SSH (Advanced)

  1. Connect to your server via SSH.
  2. Navigate to your website's logs directory: cd /var/www/vhosts/yourdomain.com/logs
  3. View the error log with: cat error_log or tail -f error_log for real-time monitoring.
  4. For system-wide logs, check: cd /var/log and explore relevant directories.

Common Plesk Error Log Locations

  • Domain error logs: /var/www/vhosts/yourdomain.com/logs/error_log
  • PHP error logs: /var/www/vhosts/yourdomain.com/logs/php_error.log
  • Plesk panel errors: /var/log/plesk/panel.log
  • Apache error logs: /var/log/httpd/error_log (CentOS/RHEL) or /var/log/apache2/error.log (Debian/Ubuntu)
  • MySQL error logs: /var/log/mysql/error.log or /var/lib/mysql/hostname.err

 

Troubleshooting Tips

Enable Error Logging

If you don't see error logs, you may need to enable them in your PHP configuration:

For cPanel with MultiPHP INI Editor:

  1. Go to cPanel > Software > MultiPHP INI Editor.
  2. Select your domain.
  3. Set the following values:
    • display_errors = Off (for production sites)
    • log_errors = On
    • error_log = /path/to/error_log
  4. Click "Apply" to save changes.

For cPanel with CloudLinux PHP Selector:

  1. Log in to your cPanel account.
  2. Navigate to "Software" > "Select PHP Version".
  3. Click on the "Switch to PHP Options" tab.
  4. Click on "Options" tab.
  5. Find and enable the following options:
    • Set display_errors to Off (for production sites)
    • Set log_errors to On
  6. Click "Apply" to save all changes.
  7. Note: PHP Selector allows setting different PHP versions and configurations per user or per directory, offering legacy PHP versions not available in MultiPHP Manager.

For Plesk:

  1. Go to Websites & Domains > select your domain > PHP Settings.
  2. Set the appropriate error reporting values.
  3. Click "OK" to save changes.

For Plesk with CloudLinux PHP Selector:

  1. Log in to your Plesk Control Panel.
  2. Go to "Websites & Domains" and select the domain you want to configure.
  3. Click on "PHP Settings" in the right sidebar.
  4. If CloudLinux is installed, you'll see "PHP Selector" - click on it.
  5. Select your desired PHP version from the dropdown menu.
  6. In the "PHP Settings" section below:
    • Set display_errors to Off (for production)
    • Set log_errors to On
  7. If available for your account, click on "Custom Values" tab.
  8. Add a new custom value: error_log with the value /var/www/vhosts/yourdomain.com/logs/php_errors.log
  9. Click "OK" or "Apply" to save your changes.

Common Issues

  • Empty log files: Error logging might be disabled in PHP configuration.
  • Permission denied: Ensure you have sufficient permissions to access log files.
  • Log rotation: Some logs may be archived. Look for files with date extensions like error_log.1.

Monitoring Logs in Real-Time

Using SSH, you can monitor logs in real-time with:

tail -f /path/to/error_log

This displays new entries as they're added to the log file.

Pro Tip: For large log files, use grep to filter for specific errors:

grep "Fatal error" /path/to/error_log
Kas see vastus oli kasulik? 0 Kasutajad peavad seda kasulikuks (0 Hääled)