Quite often, hosting owners are tormented by the constant error message 500 (Internal Server Error). She, as it is called, is simply poisoning life for many. Now we will try to briefly understand the essence of the situation itself and see how we can get rid of the appearance of errors in the future.
Internal Server Error: what is it?
So, let's start with the very meaning of this phrase. In the system (directory) of Windows errors (and not only) there is an error number 500 that corresponds to the computer term Internal Server Error. Translation of this phrase means an internal server error related to the status of the HTTP protocol.
Essentially, an error means that the server software either does not work or works, but one or more of its components fails in the form of a denial of client requests, for example, a search engine or Internet browser.
Causes of error
Speaking about the error Internal Server Error in the broadest sense, it is worth considering that it can occur on a variety of sites or resources written using completely different CMS. Here, by the way, it is necessary to distinguish between the causes of its occurrence.
Very often this situation can be observed on sites such as WordPress, OpenCart, Joomla, etc. If, however, management structures like WordPress are not used when building the site, the reason may be that the hosting itself fails to connect the wrong PHP extensions , or the site after the request returns invalid HTTP headers that cannot be recognized by your server.
An equally common cause of the Internal Server Error error is the lack of correct access rights. So, for example, if the PHP script files that are hosted have 777 access rights, it may very well be that their execution is simply blocked by the server, as a result of which an error message is issued.
Also, one of the reasons may be quite a long work of scripts. The fact is that PHP-time limits are not only valid for hosting, such limits can also be set on the server side. In other words, it somewhat resembles the operation timeout. When the server for a certain time does not receive a response to the request, it simply blocks the execution of the script.
In some cases, the Internal Server Error may occur when the hosting has exceeded the limit of used memory. Simply put, a script requires more than it needs to be executed, and after all, such a limit is set not only in PHP, often there are restrictions on the resource consumption of all executable scripts.
Finally, one of the most common situations when an Internal Server Error occurs is the content of incorrect directives in the .htaccess file (by the way, when working with the WordPress engine this is most common). Now we have come close to finding a solution for each specific situation.
Error Internal Server Error: how to fix the simplest ways
First, let's see what can be done if incorrect permissions are detected. In this case , access rights 777 allow you to edit the contents of absolutely everything, which, of course, affects security. In such a situation, you need to change them by applying the value 755 to the folders, 600 to the script files, and 644 to all steel data files.
If the executable script runs for too long, you can try to increase the waiting time, however, there is one catch. Such a solution may work on a dedicated server or VPS (Virtual Private Server), and in the case of shared hosting, there will be no effect.
As for the excessive memory consumption compared to the restrictions on the hosting, you can only advise contacting the support team or simply changing the hosting provider itself, whose restrictions will not be so severe.
Now a few words about the .htaccess file. The fact is that it involves the use of very strict syntax, if during the settings there were errors or some inaccuracies, the Internal Server Error could not be avoided. Here you need to do as follows. First you need to check the presence of the file itself in the root directory of the site, after which, having made a backup copy of it, delete it completely and completely. If after this procedure the site becomes operational again, then the problem is in the .htaccess file, which will have to be checked for errors in the syntax.
WordPress Engine Issues
WordPress is worse. The fact is that this engine is able to overwrite the original .htaccess file, which is responsible for controlling access to files and folders of the hosting, but the original file should be created only once, and especially not in WordPress!
The easiest way to fix this situation is to disable the WordPress theme and use any other instead. If the error has disappeared, it is the topic itself, if not, you need to turn off the WordPress plugins step by step and check which one affects the performance.
In some cases, you may need to upgrade WordPress to the latest version and disable the file overwrite feature. To get started, download the original .htaccess file to the computer terminal, then enter the folder on the website along the path / wp-admin / includes / with the subsequent file upload misc.php, which must be opened, say, in the standard Notepad (or any other text editor) and find the line of the function "function save_mod_rewrite_rules". Now in the function itself, we go to the line βreturn insert_with_markers ($ htaccess_file, 'WordPress', $ rules);β and replace it with "return true;" (Naturally, all commands are written without quotes). It remains only to save the changes and upload the new file to the hosting with the replacement of the old misc.php file.
The only drawback of this method is that in this case, WordPress updates are disabled. When plugins are connected, they naturally will not work.
Conclusion
In principle, these are, so to speak, the most common causes of errors and methods for eliminating them. In fact, there are many reasons that there can be many ways to deal with such situations, so you have to analyze the situation in each specific case, and only then choose which method to use to correct the error .