What is a 500 Internal Server Error? (with Causes & Methods)

User Author

Achilles.H

October 26, 2023

What is the 500 Internal Server Error? (with Causes & Methods)

What is a 500 Internal Server Error? The 500 Internal Server Error means that the server encountered an internal error or misconfiguration and was unable to complete your request. Staying in this error status will affect a website's ranking and visitors’ experience. Once the problematic areas are found and corrected, the 500 Internal Server Error will be eliminated immediately. Thus, we will discuss the causes and fixing methods for the 500 Internal Server Error in this article.

Part One: What Causes the 500 Internal Server Error?

Here are some typical causes of this server error:

• The network server is faulty temporarily.

• The .htaccess file encoding format is wrong.

• Files and folders permission are misconfigured.

• PHP is timed out.

Part Two: How to Fix the Internal Server Error?

1. Reload Your Website Page

The internal server errors may be temporary; to resolve that, you could reload a web page. You can do this by clicking the refresh/reload button, pressing F5 or Ctrl + R, or trying the URL in the address bar again.

2. Check the Server Error Logs

When you encounter a 500 Internal Server Error, you should first check your server error log to analyze the reason for this error.

Here are the paths to check the error log on different kinds of servers:

Apache: /var/log/apache2/error.log

Nginx: /var/log/nginx/error.log

Windows IIS: %SystemDrive%\inetpub\logs\LogFiles

If you are using cPanel, find the METRICS, then click Errors to check the error log messages.

cpanel metrics errors cpanel error log messages

3. Check the .htaccess File Format

If the .htaccess file format was saved as a non-UTF-8 character, this may cause an internal server error.

Step 1: Open the .htaccess file with the editing tool (Notepad, Dreamweaver, and so on). You can also check whether it is in UTF-8 format at the bottom of the left.

use notepad to change htaccess file format

Step 2: Click File > Save as... > Encoding > Select UTF-8 > Save. Then upload .htaccess file to the server.

save as utf 8 character encoding

PS: What is the difference between UTF-8 and UTF-8 with BOM?

The biggest difference between UTF-8 and UTF-8 with BOM is whether the BOM (Byte Order Mark) is present or not. UTF-8 does not require a BOM to indicate the byte order but can use a BOM to indicate the encoding.

However, it is recommended to use UTF-8 without BOM; otherwise, it will often cause errors.

4. Check the Files and Folders Permission Settings

The default permissions for background directories and folders should be 755;

755(rwxr-xr-x) represents:

The file owner's permission: Read, Write, and Execute.

The group's permission: Read and Execute.

The permissions of others: Read and Execute.

For HTML files such as images, text, etc. should be 644;

644(rw-r--r--) represents:

The file owner's permission: Read and Write.

The group's permission: Read-only.

The permissions of others: Read-only.

5. Set the PHP Script Maximum Execution Time

Sometimes, a Web server may need to respond to a request from a remote server to complete processing from a client. These external resources may show a timeout. You can fix this error by increasing the timeout value so that the remote server will not return a timeout error, but instead wait for the request to be processed.

Steps to increase the execution time: Open the php.ini file > Find max_execution_time=30 > Change the value to max_execution_time=600.