What Is A 500 Internal Server Error? How To Fix 500 Internal Server Error
A 500 Internal Server error can be caused by many things, including but not limited to invalid permissions, invalid ownership, bad lines in your php.ini or .htaccess file, invalid requests in the script, faulty plugins or themes, incompatible PHP version, and others not mentioned here.
Checking the Error Logs in cPanel for specific information is highly recommended.
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 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:
- What is SSH Access and How to Enable It in Your Hosting Account
- What Are SSH Connections - How To Edit In PuTTY, Mac, & Linux
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 out a line in the .htaccess by adding # 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 FancyURL's) 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). On a server with phpsuexec, this will also result in a server error.
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. In that php.ini file, you can change all the php values. You only have to put the values you want to modify in that file. For example, if you want to set the short_open_tag
to Off,
you would have used short_open_tag? = off
in your .htaccess 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.
Important: Before making any changes to an existing website, you strongly recommend that you back up the database first.
Checking the Error Logs
- Open the File Manager.
- Locate the error logs within the website's directory or document root: /home/cpanel_user/public_html/error_log for the primary domain.
- If you are unfamiliar with reading error logs, please see Error Logs.
- If there are no errors to troubleshoot, see this WordPress Codex article on how to enable debugging in WordPress.
Troubleshooting File Permissions
- Log in to your Bluehost Account Manager.
- Click the Hosting tab on the left-hand menu.
- Look for the hosting package name 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.
- Click the FILE MANAGER button under the Quick Links section.
- Once inside File Manager, click on Permissions from the upper right side of your screen.
- You will be prompted to edit it in a window that will look like these:
- Directories and folders should be 755. For example, executable scripts within the cgi-bin folder must be 755. Images, media, and text files like HTML should be 644.
- Files - 644
- CGI Scripts - 755
- Directories - 755
Pro Tip! You can modify permissions with the File Manager, located in the "Files" category of the cPanel. You may also edit each folder or file individually by double-clicking on the permission code to its right.
Troubleshooting Index Files
If there are no error messages in the error_logs, there may be multiple index files in the domain's root folder.
Note: If the default file (index.html, I: dex.php, default.html) is empty, the page will appear as the WSOD. It is important to check the directory index and note the file size.
- To check, open the File Manager.
- Choose the folder of the domain you are working on.
- Locate any additional index files besides index.php.
- If other index files are present, temporarily rename them (so they are not recognized as index files).
Note: If this fixes the issue, the customer must move the duplicate index file(s) elsewhere.
Troubleshooting Faulty Plugins and Themes
To deactivate plugins via the WordPress Dashboard, follow these steps.
- Log in to the WordPress Dashboard.
- Click Plugins on the left-hand side menu.
- Locate the plugin from the list. If the plugin is active, click Delete.
- Confirm that you'd like to delete the plugin and any data it contains.
To deactivate plugins via the phpMyAdmin, follow these steps.
- Log in to the Account Manager.
- Click the Hosting tab on the left-hand side menu.
- Under Quick Links, click on cPanel.
- Click phpMyAdmin under the Databases section.
- Locate and click the database to view the tables.
- Click the table name that ends with "options."
- In the "options" table, click on the column heading "option_name" to sort the table rows by name. This should make active_plugins the first table row.
- Click the Edit link on the active_plugins row, then clear out all text in the option_value box.
- Click the Go button.
To deactivate themes in WordPress, follow these steps.
- Log in to the WordPress Dashboard.
- Click Appearance on the left-hand side menu.
- Locate and hover your mouse over a theme to see the Theme Details options, and then click Theme Details.
- Confirm that you want to delete the theme.
To change themes in WordPress, follow these steps.
Note: The following instructions will explain how to change the theme settings in WordPress without the WordPress dashboard.
- Log in to the Account Manager.
- Click the Hosting tab on the left-hand side menu.
- Under Quick Links, click on cPanel.
- Click phpMyAdmin under the Databases section.
- Find your WordPress database in the list of databases.
- Click the table name that ends with "options."
- In the options table, locate the rows for the template and stylesheet.
- 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.
- Once done, click the Go button.
For detailed instructions, please check out the How to Disable/Delete Themes and Plugins in WordPress article.
Troubleshooting the .htaccess File
If you have ruled out both the theme and plugins, you can move on to the .htaccess.
- To access this, open the File Manager and add &showhidden=all to the end of the URL.
- Choose the folder to which the domain you are working on is pointed.
- Rename the current .htaccess to .htaccess(currentdate). This disables the current .htaccess.
- Next, you will need to create a new default .htaccess file.
- Click New File from the main File Manager toolbar (far left-hand side).
- Name the new file .htaccess.
- 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
- Click the Save changes button once done.
- If the .htaccess is responsible for the error, replacing it with a generic .htaccess (code from step number 6) should bring the site back.
- If the site is still down after replacing the .htaccess, delete the file you created and rename the original file back to .htaccess.
Troubleshooting PHP Version Incompatibility
Ensure that your PHP version is up-to-date and compatible with your scripts. Upgrading or downgrading PHP may resolve compatibility issues. 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.
- Log in to your Bluehost Account Manager.
- Click the Websites tab from the left-side navigation.
- Click the SETTINGS button for the website you would like to update.
- Next, click on the SETTINGS tab.
- Under the Settings page, scroll down to the PHP Version section, where you will see your website's current PHP version.
- Click the CHANGE PHP VERSION button.
- Select a PHP version from the drop-down, then click APPLY.
- 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.