DMT Web Hosting is too concerned about the health and safety of both clients and employees. Our office is closed due to COVID-19 countrywide lock down. You can reach us on +92 300 044 4656, +92 321 112 6660 during the lock down period. We appreciate your understanding and patience.

How to correct a 500 Internal Server Error?

Visitors to your website no longer see the content, but only the server error 500? As a website operator, you should directly address the problem, because it will not only be annoying for visitors to your site, Google could also decide to penalize you in terms of SEO. Before taking any action as a Webmaster, first check if your server is still running. Otherwise, quick contact with your hosting provider is required.

yDSvX

If there is an internal error, first look at the log files: for Linux servers, the collection of error messages is under / var / log / httpd / error_log. It is therefore useful to reload the website to reproduce the HTTP 500 error, while observing the creation of the Log file. So you can find the source of the error fairly quickly. In many cases, improperly programmed or incompatible plugins provide error messages.

The error can also occur if you have not set permissions for important files correctly. There are generally three types of rights:

Read (r for read)
Write (w for write)
Execute (x for execute)

These permissions can be assigned to three different types of users:

File owner
User group
All the others

The rights are indicated either by the abbreviations r, w and x or by the corresponding numerical values: 4 to read, 2 to write and 1 to execute. They are added for each type of user and are given one after the other: rwxr-xr-x (rwx for the owner, rx for the group and rx for all the others) or 755. This configuration (also 755) should be the standard setting. If the assignment of rights is defined differently, the error may occur.

Then check if your scripts work correctly (unless the distribution of rights produced the error message). Sometimes errors occur because the script files have been moved, renamed or deleted. Also check the .htaccess file as a syntax error, no matter how small, can generate an internal error at the server level. Another common error is the incorrect formatting of the .htaccess file. The latter must be created in ASCII or ANSI format, but as Unicode. Therefore, write the file in a text editor such as Notepad, Notepadd ++ or Sublime Text, and not in a word processing program such as Microsoft Word. In order to test whether the file is responsible for the error, you can rename it and reload it temporarily. The server will not access .htaccess while the site is loading. If the error message no longer occurs, you can repair the file or create a new one.

Timeout

Finally, a timeout can also lead to the error message. In this case, it is not a web server error, but rather a broken connection to an external source. Are the PHP scripts on your site configured to allow you to access resources from other servers? The resource may not be available, or the server communication may be disrupted for some other reason. One possibility to exclude this source of error is to make your page independent of external resources. If this is not possible, you can increase the delay of your script. It is also relevant to include effective error handling, so that errors in the PHP script can be detected more quickly.

Can the memory be overloaded?

The memory limit is used to determine the amount of memory that a process can take. If more RAM is required, an internal server error may result. You can set the limit as a temporary solution. To do this, add an command to php.ini according to this model:

memory_limit = 512M

In this example, you are making 512 MB of memory available. Keep in mind, however, that your hosting provider offers you a specific PHP script limit in the reserved offer. If you enter a higher value, the web server will ignore it. Adjusting the limit can only be a transitional solution: once your page reappears, you should look for the reason for the high RAM requirement. It is very likely that the error is in the code of your site.

If among the above methods you are unable to find a solution, it is a good idea to contact your hosting provider. Before you can check the status of the servers: many hosting service providers announce the status of their servers via a status page or inform users via social networks in case of problems.

Share on facebook
Share
Share on twitter
Share
Share on linkedin
Share
Share on whatsapp
Share

Fill out the form to send Email

DMT Web Hosting is too concerned about the health and safety of both clients and employees. Our office is closed due to countrywide lock down. You can reach us on +92 300 044 4656, +92 321 112 6660 during the lock down period. We appreciate your understanding and patience.