Top

How to fix a 500, internal server error

One of the most common website errors is the “500 internal server error”. This generic error does not provide information about what has caused the error, so searching for a solution could take some time. When the 500 error pops up, it may raise your heartbeat for a couple of seconds, but please try to stay calm as often the solution is nearby. In my career I’ve dealt with a couple of these errors and was able to solve them all within a short period of time. I realize that a lot of time is saved by knowledge and experience in this matter, so I decided to provide you with some hands-on tools. It will also be good to mention that this is not an error that is related to specific software. Often it is a combination of things or just a simple typo.

The .htaccess file

The .htaccess file is located in the main directory of your software installation. Sometimes the .htaccess file is not visible due to a restriction on showing hidden files. Please make sure there’s no restrictions to view hidden files within your FTP program or cPanel file browser.

Show hidden files in FileZilla

Show hidden files in FileZilla

In the FileZilla top menu, click on “Server – Force show hidden files”

Show hidden files in the cPanel File Manager

Show hidden files in cPanel File Manager

Log in to your cPanel and click on “File Manager”. The program will open in a new browser tab. Within the File Manager, click on “Settings” and select “Show Hidden Files (dotfiles)”.

After you have located the .htaccess file, rename it to something like .htaccess_old. Now refresh your browser window and see if this has resolved the error. In most cases it does. When you’re working in WordPress you can generate a new .htaccess file by logging in to your admin panel and go to “Settings – Permalinks” and click the save button.

Increase the PHP memory limit

A 500 server error sometimes happens when your website is exhausting the PHP memory limit of your web server. You can easily raise the PHP memory limit by creating a blank text file and name it php.ini. Now paste this in the php.ini file you just created:

memory=64MB

Upload the php.ini file to your server (for WordPress upload it to your wp-admin folder).

Alternatively you can increase the PHP memory limit in your WordPress config.php file. Although the new WordPress editions already have this covered. However, if your website is still running on an old WordPress version, you can try increase the PHP memory limit by pasting this into your wp-config.php file:

define (‘wp_memory_limit’, ‘64M’)

If increasing the PHP memory limit had fixed your 500 error, please also contact your web host as it might occur again after installing or updating plugins and/or software. The error could’ve been caused by a badly coded plugin or CMS template. Further investigation is absolutely necessary.

Read more about increasing the PHP memory limit

[bctt tweet=”This is how I solved my 500 internal server error”]

Other solutions

If none of the above worked for you, it is time to roll up your sleeves and try the following:
– In WordPress, deactivate all plugins and see if this fixes the issue. If it did, activate all plugins one by one and also refresh your website after activating each plugin. This will tell you which plugin(s) has caused the issue.

– Change the permissions of your admin folder to 755

– Make a backup of your files and database and upload all core files. Do not upload the theme and config files as this might cause other errors. If you’re working in WordPress, it will be safe to upload clean versions of your wp-admin and wp-includes folders.

Submit a ticket to your web host

Still no luck? Submit a ticket to your web host and ask them to investigate the issue. It might help to also include the steps you have already taken to try solve this issue.

Share you experience

Did you find the tips in this article helpful or do you have another experience with 500 server errors that you want to share? If you have a solution that is not been mentioned, please reply as well. I am curious about your experience.

Posted in

Noud

Noud is an experienced web developer and founder of Data Roots. His passion is to develop high-quality websites for his customers that will last for many years. Noud's got 20 years experience developing websites for companies of all sizes and loves to help. Contact Noud.

Comments

  1. Alisia says

    This is a lifesaver, thanks so much! My website encountered a 500 error and your solution of refreshing the .htaccess file and permalinks worked for me. My website is back online again thanks to you 🙂

Leave a Reply

Your email address will not be published. Required fields are marked *