500 Internal server error and how to fix it

Nadejda

· 10th February 2020·Wordpress, Hosting, Website Maintenance, Fixing WordPress errors

Excerpt

Have you encountered the 500 internal server error on your website? This is one of the most common WP errors and as it does not give any clear information, it can be quite frustrating.

500 Internal server error and how to fix it

Have you encountered the 500 internal server error on your website? This is one of the most common WP errors and as it does not give any clear information, it can be quite frustrating.

What causes the 500 Internal Server Error?

This is not a specific WordPress error, as it often happens to any site running on a web server. As the nature of the error is quite generic is does not provide any additional information to the developer.

Often the reason can be caused by theme functions or a plugin. Other possible reasons can be PHP memory limit or corrupted .htaccess file. There are also cases of internal. server error showing up when you are trying to reach your admin area while the rest of the site is perfectly fine.

Enable Debug Mode

Did you know that WordPress has its very own way of handling errors? By default, wordpress will probably show you a default message saying that there's an error with the website and that you need to contact the website administrator. But wait a second... you are the website administrator! No need to panic, first thing to do is enable WordPress's debug mode. You can do that by opening your site's files, find the wp-config.php file and edit it. Close to the end of the file, you will see a line with the following:

define( 'WP_DEBUG', false );

All you need to do is change this to be true. It should look like this:

define( 'WP_DEBUG', true );

After that, refreshing your site will give you a much more detailed and comprehensive error.

Check for Corrupt .htaccess File

The first thing which needs to be done in case of troubleshooting is checking for the corrupted .htaccess file.

This can be done by renaming your main .htaccess file to for example .htaccess_old. This can be done by logging into your website and using FTP or File Manager app from your hosting account’s cPanel.

Once inside, you can locate the file in the same directory as folders like wp-admin, wp-content, or wp-includes.

After renaming the file, check your site and see if the problem is solved. If the issue is gone, go to Settings-Permalinks in your WP Dashboard and click on Save without making any additional changes. This will generate a new .htaccess file with the necessary rewrite rules, ensuring your post pages will not return a 404 error.

If the issue remains, keep on reading.

Increase the PHP Memory Limit

Sometimes the internal server error can occur when you have no PHP memory left. If you see the error only when logging into the WP admin area or uploading images, then you need to increase the memory limit:

  • Create a new blank text file and name it php.ini
  • Paste the code: memory=64MB
  • Save file
  • Upload it to the /wp-admin/folder using FTP

If increasing the memory limit fixed your problem, be advised this is a temporary solution. You need to find the cause for the exhaustion of your memory limit.

This could mean a poorly coded plugin or some theme function. If the issue continues, the reason lies elsewhere.

Deactivate Your Plugins

If the above solutions were of no use for you, then the reason us probably caused by a plugin. It’s possible that it’s a combination of plugins that do not mix well.

Unfortunately, you need to deactivate all plugins at once.

If the error is fixed by deactivating your plugins, then the next step is finding out which one caused the problem.

Go to your WP admin area and click on Plugins. Start reactivating plugins one by one until you locate the one causing the problem.

Re-uploading Core Files

If you are still facing the error, then it’s wort to re-upload the wp-admin and wp-includes folders from a new WP install.

This will NOT lead to losing your information, but if your file was corrupted, it will fix the problem.

Visit the WordPress.org site and do it to Download.

This will install a zip file on your computer. Extract the files and locate the WP folder.

The next step is connecting the WP website to an FTP client. Once it’s done, go to your website’s root folder, which includes wp-admin, wp-content and wp-includes in it.

Open the WP folder in the left column. Select the wp-admin and wp-includes folder, right-click and then Upload.

Your files will be transferred to the server using FTP client. It will ask if you wish to overwrite the files. Select Overwrite – Always use this action.

The FTP client will replace the older WP files with new copies. If the files were originally corrupted, this should fix the internal server error.

Ask your hosting provider

If all of the above methods fail, time to call for back up. Get in touch with your hosting provider, so that they can check the server logs and root cause for the error.

We hope this article was useful for you if you need further information on the topic do not hesitate to contact us!

Nadejda
Nadejda Milanova

Get 10% off your order

UYD-772-MK5

Enter UYD-772-MK5 at the checkout to get 10% off one-time tasks or any maintenance plan.

Get started