Quite often, hosting owners sufferdue to the constant occurrence of the 500 (Internal Server Error) error message. She, as it is called, many simply poison life. Now we will try to briefly understand the essence of the situation itself and see how we can get rid of the appearance of an error in the future.
Error Internal Server Error: what is it?
So let's start with the meaning of thisphrases. In the system (directory) of Windows errors (and not only) there is an error number 500, corresponding to the computer term Internal Server Error. Translating this phrase means an internal server error related to the HTTP protocol status.
Essentially, an error means that the softwareThe server’s provisioning either does not work or is working, but one or more of its components fail in the form of denying client requests, for example, a search engine or an Internet browser.
Causes of error
Speaking of the error Internal Server Error in the verybroadly understood, it should be borne in mind 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 the causes of its occurrence.
Very often such a situation can be observed onsites like WordPress, OpenCart, Joomla and others. If management structures like WordPress are not used when building a site, it is possible that the hosting itself fails when connecting incorrect PHP extensions, or the site returns incorrect after the request HTTP headers that cannot be recognized by your server.
No less common causeInternal Server Error can be called the lack of correct access rights. So, for example, if PHP files of scripts that are hosted on a hosting 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 reason may be enoughlong work scripts. The fact is that PHP execution time limits do not apply only to hosting, such limits can also be set by the server. In other words, this is somewhat reminiscent of 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, Internal Server Errormay appear when hosting is exceeding the limit of used memory. Simply put, the script for execution requires more than it should be, and after all, such a limit is not only set on PHP, there are often restrictions on the consumption of resources by all executed scripts.
Finally, one of the most common situationsthe occurrence of the error Internal Server Error is the content of incorrect directives in the .htaccess file (by the way, this is most often manifested when working with the WordPress engine). 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 withdetecting incorrect permissions. In this case, the 777 permissions allow you to edit content for absolutely everyone, which undoubtedly affects security. In such a situation, it is necessary 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 is too longYou can try to increase the waiting time, however, there is one snag. Such a solution can work on a dedicated server or VPS (Virtual Private Server), and in the case of virtual hosting there will be no effect.
As for memory overcharge inCompared with the restrictions on the hosting, you can only advise to contact support or simply change the hosting provider, whose restrictions will not be so tough.
Now a few words about the .htaccess file.The fact is that it assumes the use of a very strict syntax, if errors were made during the settings or some inaccuracies, to avoid the appearance of the Internal Server Error error will fail. Here you need to do the following. First you need to check the presence of the file in the root directory of the site, and then, after making a backup copy, delete it entirely. If after such a procedure, the site becomes operational again, then the problem is in the .htaccess file, which will have to be checked for syntax errors.
WordPress issues
WordPress is worse.The fact is that this engine can overwrite the original .htaccess file, which is responsible for managing access to the files and folders of the hosting, and the original file should be created only once, and certainly not in WordPress!
The easiest way to fix this situationis to disable the WordPress theme and use any other instead. If the error has disappeared, the point is in the topic itself, if not - you need to gradually disable WordPress plugins and check which one affects the performance.
In some cases it may be necessary to updateWordPress to the latest version and disable the file overwrite feature. To begin, download the original .htaccess file to the computer terminal, then enter the folder in the folder along the path / wp-admin / includes / and then download the file misc.php, which needs to be opened, for example, in the standard Notepad (or any other text editor) and find the function “function save_mod_rewrite_rules” line. Now, in the function itself, go to the line “return insert_with_markers ($ htaccess_file," WordPress ", $ rules);" and replace it with "return true;" (of course, 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 file misc.php.
The disadvantage of this method is only that in this case the WordPress update is disabled. When connecting plug-ins, they will not work, of course.
Conclusion
In principle, this is, so to speak, the mostcommon causes of errors and methods of its elimination. Actually, there may be a lot of reasons for coping with such situations, so you will have to analyze the situation in each specific case, and only then choose which method to correct the error to use.