IT MaintenanceWebsite Development

How to fix 500 internal server error in WordPress

Spread the love

The 500 server error is an HTTP status code that we can see on our web pages that tells us that the server failed to complete a valid request because the source code is wrong or the web server is unable to execute the request. It usually manifests on a blank page that the web server has configured by default. Here, we present How to fix 500 internal server error in WordPress.

It is a clear symptom of failure in the programming in any of the files or of any incompatibility between the versions in which the script was developed and the PHP versions of the hosting server.

How to fix 500 internal server error

How to fix 500 internal server error

Most HTTP errors produce the internal error in the server ( Service Unavailable ) caused by the following causes:

  • Programming or web design error in any of the scripts or plugins that are running
  • Due to problems with the .htaccess lines of the web pages
  • Incorrect permissions on folders or files
  • Lack of memory in the execution
  • PHP version not compatible with running scripts
  • Timeout
  • Service saturated and with few free resources
  • Lack of disk space
  • Error 500 infographics

Troubleshooting error_log

error_log

Servers like Apache record in a file called ” error_log ” this type of error log will give us a hint of the file that is causing the problem. This register saves the scripts that produce an error, so it will be very easy to detect them whenever you have access to it.

If your account has this record you will have isolated the problem easily. Simply by checking the contents of this file, you will know which script is causing the problem on your website and even in the code line where it originates

However, not all accommodations enable this option or use Apache as a web server. In this case, we will have to investigate a little more thoroughly what is bothering us the day!

We show you some possible solutions to use to banish the problem of the 500 internal server error definitively.

Temporarily disable the .htaccess

htaccess file

It is possible that the internal error of the server is caused by a damaged .htaccess file or with lines incompatible with your server. To eliminate this error message, it is necessary to correct the file.

You can access your file. Access by opening the root directory.

Access through the file manager or FTP. Once you find it, right click and rename it to “.htaccess.ancient” for example.

This will disable the execution of the file. htaccess from your site temporarily.

NOTE: If your server has a Microsoft OS, this .htaccess file will not be in your system and may not be the cause.

After doing this check if the site no longer gives the error. If you keep giving it, you need to run some more tests to detect the source of the problem.

Check folder and file permissions

Another common cause is to have the folders or files of your web configured in the wrong way. As a general rule, you should always have the following security permissions:

  1. Folders: 755
  2. Files: 644

To review the permissions and see if there are any wrong you will need to access the file manager or FTP.

Timeout

If the error occurs when you import external elements to your web, such as an import of data using csv or xml files, surely the internal error 500 occurs because the timeout of the server runs out before the data can be imported.

Contact your provider to increase the execution time of the scripts.

TECHNICAL NOTE: The gateway timeout errors that are what are called these types of errors usually occur in Nginx servers or handlers such as PHP-FPM or FastCGI.

Error 500 in WordPress

If your website is developed with this cms, then surely you have seen this error ” 500 internal server error ” several times. I’m with you that sometimes is frustrating, but you have to arm yourself with patience and look for the source of the problem. Let’s put some general solutions on the table to eliminate this message:

Increase memory limit

The web hosting companies and self-script execution limits set in memory. You can increase these limits as much as possible in 2 ways:

In the accommodation

Normally you should increase the execution memory by raising the ” memory_limit ” parameter in your shared account. To do this, you must add a line to your custom php.ini:

memory_limit = 256M;

If you can not use this type of file, you can try using a .user.ini file by adding the same line. In this case, it would be necessary to restart the web server for the changes to take effect, which is a shared would be unfeasible.

Another option is to add a line to the .htaccess that you have hosted in the root. The line would look like this:

php_value memory_limit 256M

This will increase the execution memory to 256 Megabytes. If you have your hosting with us, you should use this last option, the .htaccess option.

If you do not have access to any of the previous files on your server, you can try to increase the limit directly on your installation. You can use the cPanel file manager to do this.

For this, you must edit the wp-config file of your site. Click on the file with the right button to edit it and add the line:

define(‘WP_MEMORY_LIMIT’, ‘256M’);

You now need to check if increasing this limit the HTTP 500 error has disappeared. Are you still giving it?

define code

Try deactivating your web plugins

Disable the plugins one by one to check if there is any failure in any of them. If the error is resolved after disabling all plugins, then permanently isolate and remove the plugin that causes it.

Here the best thing is to activate one by one until you see which is causing the error.

Backup copy

If after all these steps you still see error 500 on your website, the next step would be to re-upload the folders “wp-admin” and “wp-includes” from your same WP version.

Do not be afraid to do this operation. The image and theme files are saved in the “wp-content” folder. It never hurts to make a backup of these folders before “crushing” them with the core files.

Comment here

This site uses Akismet to reduce spam. Learn how your comment data is processed.