+1 (614) 348-7474

Copy

Free in USA

info@crocoapps.com

Copy

From 10:00 to 21:00

info@crocoapps.com

Copy

From 10:00 to 21:00

Fill out the brief

Online request

#

What is error 500 and how to fix it

Crocoapps editorial

Crocoapps editorial

Reading time: 11 minutes

A 500 Internal Server Error occurs when the server cannot reliably determine why it is unable to process a request from a user. The site becomes inaccessible to visitors and search robots. Completely lost traffic and conversions. The business situation is critical. How to fix it - we will tell in the article.

What can cause it

  1. Access denied.

Sometimes, when moving to a new hosting or expanding the resource structure, webmasters forget to open access to files and directories on the server.

  1. Mistakes in .htaccess.

Due to incorrectly written directives in .htaccess. Apache web server is having trouble reading site files correctly.

  1. Incorrect extension.

This problem usually affects PHP and CGL scripts. They may have the wrong extension or an outdated, unsupported version.

  1. Script execution timeout.

An error occurs if external PHP processing times out.

  1. Lack of allocated memory.

Most hosts limit the amount of RAM for executing scripts.

  1. Incorrect CMS settings.

Some content management system plugins - especially WordPress and Joomla - can cause a 500 error due to lack of updates or incompatibility.

How to diagnose

The file “error.log” needs to be opened. To do this, you can use the FileZilla client or the hosting/VPS control panel.

How to diagnose error 500

A detailed error report will be available in error.log. Sites running on Microsoft IIS servers give a more accurate error code. For example, 500,19 - “Configuration data is invalid”.

Corrections

The procedure for correcting an error depends on the nature of its occurrence.

Invalid code in .htaccess

There are two ways to check if the lines in the file affect the operation of the resource:

  • copy the document to your computer and delete it from the server;
  • rename to test or give any other name;

If after that the 500 error is eliminated, you need to find the incorrect directives that cause it.

You can do it manually. For this:

  • comment all lines of code except the first one;
  • updating the file on the server;
  • Check if the file is working.

If the error persists, we perform the listed actions sequentially with each line in the code. If there is no error, check the spelling of the uncommented directive.

To save time, you can start diagnosing .htaccess using an automated tester - for example, the htaccess test online service. To check the code, you need to enter the contents of the file into the window and specify the site address. The tester will issue a report highlighting incorrect directives in red.

Sometimes the strings turn out to be incorrect due to the inconspicuous replacement of Latin letters with Russian ones - most often - “s”. You can detect and fix the problem through the text.ru spell check service - it will show incorrect characters. All you have to do is correct them and re-upload the document.

No permissions

There are several access levels for directories and files:

  • read - the user can view the contents of a file or folder;
  • write - the user can create, delete and edit files in the specified folder;
  • execution - the user can run script processing.

Usually, for files, the numerical access value is “644”, for folders and directories - “755”.

Option 644 means that the owner of the resource can read, write, and edit files, while other users can only read. 755 - The owner has full access, and users are allowed to read files and execute scripts. Rights are edited through hosting or the free FileZilla client program.

Fix error 500 with the free FileZilla client
  1. Enter the root directory of the server by entering the required credentials.
  2. If you need to upload new files or folders to the server, drag them from your local computer.
  3. Enable showing hidden files.
  4. Select objects of interest. In the context menu, select the “File permissions…” item. In the window that opens, enter the required numerical value or check the boxes corresponding to the categories of rights and user groups.

Sometimes, to update accesses, you need to restart the physical server on which the site is loaded.

Slow scripting

The first solution to the problem is PHP optimization. To identify and eliminate redundant code, it is better to contact an experienced programmer. You can use online code testing services to understand whether the error is exactly in the overload of the script.

The second option is to increase the time allotted for processing. But this operation is available only to owners of dedicated servers. On a virtual hosting, it will not be possible to expand the operational time.

Deprecated PHP

The PHP version and mode can be updated through the hosting panel. The specific steps depend on which file manager you are using.

Incorrect CGI scripts

CGI scripts are most commonly used when a user interacts with a web page - submitting forms, comments, ratings. The second application is the collection of data about users, that is, those same cookies.

Various errors can occur in CGI.

  1. Invalid line ending format.

For servers running Unix systems, the correct line ending is "\n". For Windows platforms, the correct character is “\m”. You can check tabs using special reactors - for example, Notepad++.

  1. Incorrect permissions.

As mentioned earlier, the correct numeric access value for executable files is 755.

  1. Incorrect HTML headers.

Error header information can be checked in the 'error.log' file.

Out of allocated memory

If you exceed the RAM limit set by the hosting, you should take the following actions.

  1. Checking the functionality of scripts.

You need to download the php.ini configuration file to your computer and audit it for errors. During testing, the following features must be enabled:

  • error_reporting = E_ALL
  • display_errors = On
  • display_startup_errors = On

After activating these commands, when you run the file, all error reports will be displayed.

  1. Change settings.

If the resource is located on a VPS server, you can adjust the memory_limit parameter in the configuration file. You can find out the optimal limit value only by experience, by updating php.ini and checking the response of the site.

  1. Contact support.

If the script code is optimized, but the 500 error does not disappear, you should contact the hosting technical support.

CMS related errors

Often problems arise due to plugins or themes used by the site management system - especially the WordPress CMS. The scheme of actions in this case is as follows.

  1. Check the .htaccess file and, if the error occurs due to it, temporarily disable all users from writing to it by setting the access parameter “644”.
  2. Change the theme you're using to see if it works.
  3. Deactivate plugins. You will have to act by brute force, sequentially disabling each installed plugin until the error is resolved.
CMS related 500 errors
  1. Extend RAM limit. At the end of the wp.config.php configuration file, add the line define('WP_MEMORY_LIMIT', '64M').

How to fix user error 500

Sometimes the root of the problem lies not in the server or the site's html code, but in the user's device/browser. In this case, you can:

  • reload the page - via the icon in the browser or the F5 button on the keyboard;
  • clear the cache and cookies - so that the fresh version of the page is loaded, and not the saved one (which could have an error);
  • check the browser for viruses - especially if the 500 error occurs frequently and on different resources. Malicious programs can slow down or interrupt communication with the service;
  • Check if browser and OS version is up to date;
  • contact the owner of the resource if you think that he does not yet know about the problem with his site;
  • just wait - most likely the problem will be fixed soon.

Conclusion

Error 500 refers to the server's inability to process commands from the user's browser. It can occur due to incorrect directives in the .htaccess file or PHP / CGI scripts, lack of RAM for processing the script, exceeding the timeout during PHP execution.

It is recommended to diagnose and fix the error using special services. First of all, you need to check the configuration files, .htaccess directives and CMS plugins.

Author

Crocoapps editorial

Crocoapps editorial