My website shows 500 HTTP internal server error

A "500 Internal Server Error" is a generic error message, and it can be caused by numerous underlying issues. Here's a step-by-step guide to troubleshooting this error on a PHP website hosted on our Linux cPanel Shared Hosting Service

 

  1. Check the .htaccess file:

    • A common cause of the 500 error is a corrupted or misconfigured .htaccess file.
    • Navigate to your website's root directory using the cPanel File Manager or an FTP client.
    • Rename the .htaccess file to something like .htaccess_backup.
    • Try loading your website. If it works, then the issue was with your .htaccess file. You'll need to pinpoint the exact problem within the file or recreate it.
  2. Inspect Error Logs:

    • cPanel> Metrics > "Error Log" section where you can view the last 300 error messages. This log might give you specific details about what's causing the error.
  3. PHP Error Logging:

    • If the error is caused by a PHP issue, it might not always appear in the Apache error logs.
    • Go to cPanel > MultiPHP INI Editor > Basic Mode > Select your domain name
    • Enable display_errors 
    • Check your website if it shows any errors. 
  4. Check File Permissions:

    • Incorrect file and directory permissions can also cause a 500 error.
    • Directories should typically have a permission of 755 and files should have 644. You can adjust these via cPanel's File Manager or an FTP client.
  5. Test PHP Code:

    • Temporarily replace your website's main PHP file (e.g., index.php) with a simple one to see if PHP is working correctly:
      php
      phpinfo(); ?>
    • If this loads correctly, then the problem is likely with your site's PHP code.
  6. PHP Version:

    • Some PHP scripts may not be compatible with all PHP versions. Check if your script requires a specific version.
    • In cPanel, go to MultiPHP Manager option where you can switch between versions. Try switching to a different PHP version to see if that resolves the issue.
  7. Check Database Connection:

    • If your website connects to a database (e.g., MySQL), ensure the database is running and that the credentials in your website's configuration file are correct.
  8. External Resources:

    • If your website relies on external resources (like third-party APIs), make sure those are operational. If one of these resources fails, it might cause your site to throw a 500 error.
  9. Plugins and Themes (For CMS like WordPress):

    • If you're using a CMS, plugins or themes might be causing the error.
    • Disable plugins one by one to see which one is causing the problem.
    • Switch to a default theme to see if a theme is the culprit.
  10. Server Resources:

  • Check if your account is using all the resources allocated to it, like CPU, RAM, or the number of processes. You can check this in cPanel > Metrics > Resource Usage
  1. Contact our Support:
  • If you're unable to identify the problem after all these steps, please get in touch with us by clicking Support on the left and opening a support request. 

Remember: Always make backups before making changes to your website, so you can easily restore it to a previous state if necessary.


Was this article helpful?

mood_bad Dislike 0
mood Like 0
visibility Views: 1162