Loading...

Knowledge Base

What Is A 500 Internal Server Error? How To Fix 500 Internal Server Error

Several factors can trigger a 500 Internal Server Error, including improper access rights, wrong file ownership, errors in .htaccess or php.ini, malfunctioning scripts, outdated or incompatible plugins/themes, and PHP version conflicts.

Example of Server 500 Error

A Server 500 error will generally look something like this:


Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.  

Please contact the server administrator, [email protected], and inform them of the time the error occurred and anything you might have done that may have caused the error.

More information about this error may be available in the server error log.

Additionally, a 500 Internal Server Error error was encountered while trying to use an ErrorDocument to handle the request. 

Possible Causes of a 500 Error

Bad permissions, Writable by Group

A bad permissions error may look something like this:


[Sun Jun 05 12:03:22 2012] [error] [client 66.249.72.82]

SoftException in Application.cpp:601: Directory "/home/exampleuser/public_html" is writeable by group

In this instance, the folder had permissions for a folder set that was too high. To correct this, the permissions need to be changed from "777" to "755".

Full instructions are available in the Troubleshooting section below.

To learn more about these, please see the Setting File and User Permissions and Changing File Permissions articles.

Other options are using an FTP client or using the chmod command in SSH/bash. Check out the following articles for more information about the SSH protocol:

Faulty Plugins and Themes

A 500 error page on your WordPress site could be due to faulty plugins or themes. Before looking into faulty themes, you may need to determine which plugin is causing the 500 error. To identify the problematic plugin, disable it and then refresh your site. See if the error comes back. If none of the plugins is causing the error page, change your theme to the default one. See detailed instructions below.

Ensure you back up your website before making any changes. 

Bad .htaccess, Invalid code, Command, or Syntax

In the .htaccess file ("dot htaccess"), you may have added lines that are either worded badly or conflicting. The best way to troubleshoot this is to comment out the lines in the .htaccess.

You can comment on a line in the .htaccess by adding a # to the beginning. You are wise to save an original copy of any file before you make changes.

For example, if the .htaccess looks like this:


DirectoryIndex default.html
        
AddType application/x-httpd-php5 php

Then try something like this:

DirectoryIndex default.html 

#AddType application/x-httpd-php5 php

Broken lines and lines that start with php_flag are the most common mistakes. If you cannot determine which line is the problem, then comment out every line.

Other common .htaccess errors

FollowSymlinks

An error may look like the following:

[Sun Jun 05 12:07:10 2011] [alert] [client 66.249.72.82]

/home1/examplec/public_html/.htaccess: Option FollowSymlinks not allowed here

In this example, the error is simple to fix; in the file specified, use a permitted directive--in this case, use "SymlinksIfOwnerMatches" instead of "FollowSymlinks," or remove the line entirely.

Syntax Not Closed

An error may look like the following:

[Sun Jun 05 12:11:38 2011] [alert] [client 66.249.72.82] 

/home1/examplec/public_html/.htaccess: /home1/examplec/public_html/.htaccess:3: <IfModule>ExampleRule/Module> was not closed.

Again, the solution is to fix the syntax or remove it simply. In this case, close the ending "</IfModule>" directive properly and put the rules on their own line to resolve the problem.

These are just a few common examples that bad .htaccess parameters can cause. What you encounter will likely vary. However, generally, the error message is descriptive enough to determine an error from it without further investigation.

Improperly configured php.ini

ForceType

When you are using files with (or without) an extension different than the normal extension for that filetype you can use ForceType in your .htaccess file to make it clear to the server how to handle that file (or all the files in the folder) (this works on servers without phpsuexec).

An example: When you have a file called "item" (like Nucleus uses for FancyURLs) and want it to be parsed by the server as PHP, you use the following code in your .htaccess file:

ForceType application/x-httpd-php

However, because our servers use phpsuexec, this will result in an internal server error. To solve this, you can simply use SetHandler instead of ForceType, so your .htaccess file becomes:

SetHandler application/x-httpd-php
php_value

On a server without phpsuexec, it is possible to use the php_value statement in a .htaccess file to change the settings of php (actually overwrite the settings from php.ini). This will also result in a server error on a server with phpsuexec.

To solve this, you can use a php.ini file, which you put in the same folder as where you would have put your .htaccess file. You can configure PHP behavior by editing the php.ini file. Only the settings you intend to change need to be included. For example, turning off short_open_tag requires adding short_openshort_open_tag? = off to the file.

Using a php.ini file results in the following:

[PHP] 
short_open_tag = Off

Incompatible PHP Version

Since the PHP versions upgrade occasionally, several websites can respond differently. There is a possibility that some of them may encounter the 500 error page. This upgrade is part of our ongoing effort to bring our customers the very best products and services. In addition to improved data processing, which can boost a site’s speed and performance, an updated PHP version provides increased security. Newer versions of PHP have more frequent security updates to help protect a website against unwanted hacks or malware.

The PHP version that is compatible with your website will depend on your website's components, such as themes or plugins. Make sure to check your theme or plugin's information pages before you change your PHP version. Better yet, create a backup of your website before making updating (or downgrading) your PHP version. If you're not sure, you may want to reach out to your web developer if needed.

Troubleshooting Guide

Please see all possible troubleshooting below for fixing the 500 Internal Server Error.

Checking the Error Logs

  1. Open the File Manager.
  2. Locate the error logs within the website's directory or document root: /home/cpanel_user/public_html/error_log for the primary domain.

Troubleshooting File Permissions

  1. Log in to your Bluehost Account Manager.
  2. Click the Hosting tab on the left-hand menu.

    Account Manager - Hosting tab

  3. Look for the name of the hosting package you need to manage.
    • If you have a single hosting package in your account, you will be routed to the Hosting Overview page right away.
    • If you have multiple hosting packages in your account, click the MANAGE button on the hosting package you need to manage.
  4. Go to the FILES & ACCESS tab and click MANAGE on the File Manager tile.
    FILE MANGER button
  5. Once inside File Manager, click on Permissions from the upper right side of your screen.

    bh-rock-fm-permission

  6. You will be prompted to edit it in a window that will look like this:

    file-permissions-755

  7. Use 755 for folder permissions, especially when dealing with script execution in locations such as cgi-bin. For standard files like HTML pages, images, and media, 644 is the recommended setting.

    file-permissions-644

    • Files - 644
    • CGI Scripts - 755
    • Directories - 755

Troubleshooting Index Files

If nothing appears in the error_logs, check the root directory for multiple index files, as this could be the source of the issue.

  1. To check, open the File Manager.
  2. Choose the folder of the domain you are working on.
  3. Search the domain’s main folder for any index files that exist in addition to index.php.
  4. If other index files are present, temporarily rename them (so they are not recognized as index files).

Troubleshooting Faulty Plugins and Themes

For detailed instructions, please check out the How to Disable/Delete Themes and Plugins in WordPress article.

To deactivate plugins via the WordPress Dashboard, follow these steps.

  1. Log in to the WordPress Dashboard.
  2. Click Plugins on the left-hand side menu.
  3. Locate the plugin from the list. If the plugin is active, click Deactivate.

    WordPress Dashboard - Plugins - Deactivate

  4. You can either choose the reason of deactivation and hit the Submit button or just click the Close this window and deactivate (Plugin Name).

    WordPress Dashboard - Plugins - Confirm Deactivation

To deactivate plugins via phpMyAdmin, follow these steps.

  1. Log in to the Account Manager.
  2. Click the Websites tab on the left-hand side menu.

    Account Manager - Websites Tab

  3. Under the OVERVIEW tab, click on the PHPMyAdmin button below.

    Account Manager - Hosting Tab - PHPMyAdmin

  4. Locate and click the database to view the tables.

    phpmyadmin-database-left-pane

  5. Click the table name that ends with "options."

    phpmyadmin-database-left-pane

  6. Sort the "options" table by clicking on the "option_id" column title. Doing so should place active_plugins at the 2nd page of the table. The option ID for active_plugins is 34.

    PHPMyAdmin - Option - Active Plugins - Go button

  7. Click the Edit link on the active_plugins row, then clear out all text in the option_value box.

    PHPMyAdmin - Option - Active Plugins - Edit button

  8. Scroll down and click the Go button.

    PHPMyAdmin - Option - Active Plugins - Go button

To deactivate themes in WordPress, follow these steps.

  1. Log in to the WordPress Dashboard.
  2. Click Appearance on the left-hand side menu.
  3. Locate and hover your mouse over a theme to see the Theme Details options, and then click Theme Details.

    Wordpress - Appearance - Theme Details

  4. Confirm that you want to delete the theme.

    Wordpress - Appearance - Theme Details - Delete

To change themes in WordPress, follow these steps.

  1. Log in to the Account Manager.
  2. Click the Websites tab on the left-hand side menu.

    Account Manager - Websites Tab

  3. Under the OVERVIEW tab, click on the PHPMyAdmin button below.

    Account Manager - Hosting Tab - PHPMyAdmin

  4. Locate and click the database to view the tables.

    phpmyadmin-database-left-pane

  5. Click the table name that ends with "options."

    phpmyadmin-database-left-pane

  6. In the options table, locate the rows for the template and stylesheet.
  7. Click Edit to change the theme and stylesheet's option_value to your preferred theme. This should be the exact, case-sensitive name of the folder inside wp-content/themes that contains the theme you want to use.

    PHPMyAdmin - Option - Active Plugins - Go button

  8. Scroll down and click the Go button.

    PHPMyAdmin - Option - Active Plugins - Go button

Troubleshooting the .htaccess File

If you have ruled out both the theme and plugins, you can move on to the .htaccess.

  1. To access this, open the File Manager and add &showhidden=all to the end of the URL.
  2. Choose the folder to which the domain you are working on is pointed.
  3. Rename the current .htaccess to .htaccess(currentdate). This disables the current .htaccess.
  4. You’ll now need to set up a new .htaccess file using the default settings to ensure the site functions correctly.
  5. Click New File from the main File Manager toolbar (far left-hand side).
  6. Name the new file .htaccess.
  7. Open the code editor and add the following code below:
    
        # BEGIN WordPress 
    
        <IfModule mod_rewrite.c>
    
        RewriteEngine On
            
        RewriteBase / 
            
        RewriteRule ^index\ php$ -[L]
            
        RewriteCond % {REQUEST_FILENAME} l-f
            
        RewriteCond % {REQUEST_FILENAME} l-d
            
        RewriteRule /index.php [L]
            
        </ifModule>  
      
        # END WordPress
        
  8. Click the Save changes button once done.
    • When the .htaccess file is the source of the error, using a generic version from step 6 could restore access to the website.
    • If the site doesn’t recover after updating the .htaccess, discard the new version and rename the original file to .htaccess to restore previous settings.

Troubleshooting PHP Version Incompatibility

Verify that the PHP version in use is current and suitable for your codebase. Switching to a different version may resolve any issues related to compatibility. For detailed instructions, please check out the What is the Latest Supported PHP Version? article.

To view and update your PHP version in your Account Manager, follow these steps.

  1. Log in to your Bluehost Account Manager.
  2. Click the Websites tab from the left-side navigation.
  3. Click the SETTINGS button for the website you would like to update.
  4. Next, click on the ADVANCED tab.
  5. Under the ADVANCED page, look for the PHP Version section, where you will see your website's current PHP version.
  6. Click the CHANGE VERSION button.
  7. Select a PHP version from the drop-down, then click APPLY.
  8. Refresh your website and check if the error is gone.

Summary

There are several reasons why you might encounter the 500 Internal Server Error. Some of the most common causes include incorrect file permissions, malfunctioning plugins or themes, a problematic .htaccess file, a misconfigured php.ini file, or an incompatible PHP version. This guide provides step-by-step instructions on how to identify and troubleshoot each of these possible causes. Remember to always back up your website before making any changes.

If you need further assistance, feel free to contact us via Chat or Phone:

  • Chat Support - While on our website, you should see a CHAT bubble in the bottom right-hand corner of the page. Click anywhere on the bubble to begin a chat session.
  • Phone Support -
    • US: 888-401-4678
    • International: +1 801-765-9400

You may also refer to our Knowledge Base articles to help answer common questions and guide you through various setup, configuration, and troubleshooting steps.

>

Did you find this article helpful?

 
* Your feedback is too short

Loading...