WordPress errors can disrupt your site’s functionality and user experience. This guide covers advanced troubleshooting for common issues like HTTP 500 errors, database connection failures, white screen of death, and plugin conflicts, all using cPanel tools.


Error 1: HTTP 500 Internal Server Error

Symptoms:

  • Blank page or “Internal Server Error.”

Causes:

  • Corrupt .htaccess file
  • PHP memory limit exceeded
  • Plugin/theme conflict

Fix:

  1. Check Error Logs in cPanel:
    • Navigate to Metrics → Errors.
  2. Rename .htaccess via File Manager:
    • Change to .htaccess_old and reload site.
  3. Increase PHP memory limit:
    • Go to MultiPHP INI Editormemory_limit = 256M.
  4. Disable plugins:
    • Rename wp-content/plugins to plugins_old.

Error 2: Error Establishing Database Connection

Symptoms:

  • Site shows database connection error.

Causes:

  • Incorrect DB credentials in wp-config.php
  • MySQL service down

Fix:

  1. Verify credentials in wp-config.php:
     
    define('DB_NAME', 'your_db');
    define('DB_USER', 'your_user');
    define('DB_PASSWORD', 'your_password');

     
  2. Check database in phpMyAdmin.
  3. Restart MySQL (requires root access or contact host).

Error 3: White Screen of Death

Symptoms:

  • Completely blank page.

Causes:

  • PHP errors hidden
  • Plugin/theme conflict

Fix:

  1. Enable debugging in wp-config.php:
     
     
    define('WP_DEBUG', true);
    define('WP_DEBUG_LOG', true);
    define('WP_DEBUG_DISPLAY', false);

     
  2. Check wp-content/debug.log for errors.
  3. Disable plugins/themes as in Error 1.

Error 4: Mixed Content After SSL

Symptoms:

  • Site loads with insecure elements.

Fix:

  1. Update URLs:
    • Use Search Replace DB or WP-CLI:
       
       
      wp search-replace 'http://yourdomain.com' 'https://yourdomain.com'

       
  2. Install Really Simple SSL plugin.

Error 5: Memory Exhausted

Symptoms:

  • Fatal error: Allowed memory size exhausted.

Fix:

  1. Increase memory limit in wp-config.php:
     
     
    define('WP_MEMORY_LIMIT', '256M');

     
  2. Adjust in MultiPHP INI Editor.

Advanced Debugging

  • Enable PHP error reporting:
     
     
    ini_set('display_errors', 1);
    error_reporting(E_ALL);

     
  • Use SSH to tail logs:
     
     
     
    tail -f /usr/local/apache/logs/error_log
     

Security Best Practices

  • Always back up before troubleshooting.
  • Use staging environment for testing fixes.
  • Keep WordPress core, themes, and plugins updated.
這篇文章有幫助嗎? 25 用戶發現這個有用 (98 投票)