Best Ways to Fix Error 500 on WordPress


 

Having a website is vital to you business, specially to the ones that rely on it to operate. Therefore if it’s down, so is your business. Here, I will show you how to fix error 500.

Fix Error 500

If your seeing this error on your browser, then it’s the famous “error 500”. Error 500s are not only existing on WordPress. This error occurs generally because of a syntax error on your code which is php, your apache or server or maybe just because of incompatibility.

 

In this post, I will show you the tested and proven ways to fix a WordPress error 500.

Backing Up Your Site

These solutions require making a lot of changes in your site’s root directory. It’s highly recommended you backup your site prior to trying any of these solutions in case something goes wrong.


Fix Error 500

WordPress rely on Php – the code, Apache – the server – and MySQL – the database to run so you might want to look on that. But to start things, lets run over the basics, then we’ll slowly run into the complex parts.

1. Check your .htaccess files

The first thing you might wanna do when troubleshooting the internal server error in WordPress is checking if your .htaccess file is broken or corrupted. You can do this by renaming your .htaccess to anything you want just to make your WordPress ignore it.

Access your server via a FTP client like FileZilla. Then go click the .htaccess file and rename it.

Then rename it

If this fixed things, then you can breath now. Make sure that you go to your wp-admin > Settings >  permalinks and click save. Doing this, WordPress would generate a new .htaccess files with the proper read, write and rewrite rules to ensure that your post pages do not return any error in the future.

 

If it somehow did not generate, WordPress .htaccess files generally have this code:

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress

 

2. Increasing WordPress’ PHP memory Limit

Every website needs a room to operate on It’s platform. Imagine your website as you and your server or hosting as the room you’re in right now. The less the space in the room, the harder you can move.

Sometimes that’s the case on WordPress and is returning an error. Exhausting your PHP memory limit is a no go.

 

Again, go to your FTP client, or Cpanel > File Manager and look for your wp-config.php file. Next, what you want to do us paste this line of code to it just before the line, ‘That’s all, stop editing! Happy blogging.’

define( 'WP_MEMORY_LIMIT', '256M' );

 

This code tells WordPress to increase the PHP memory limit to 256MB. Once you are done, you need to save your changes and upload your wp-config.php file back to your server.

After that, create a blank text file called php.ini and paste this code in there:

memory=64MB

Save the file back to your server. Several users have said that doing the above fixed the admin side problem for them.

Take note that this fix is only temporary if PHP limit is your problem. The reason why we say this is because there has to be something that is exhausting your memory limit. This could be a poorly coded plugin or even a theme function.

If increasing the PHP memory limit did not fix the issue for you, then you are in for some hard-code trouble shooting.

 

3. Deactivating your plugins

As what I’ve said earlier, WordPress works with PHP and therefore needs to run smoothly with it’s syntax. Any error that would rise during its runtime will definitely return an error.

Please take in mind that a WordPress plugin is just a custom code by it’s author and is therefore cannot be perfectly compatible on all occasions, and in most cases, the reason of a WordPress error is an incompatible plugin.

There are actually 2 ways to deactivate all plugins,

One is Via FTP

Login to your server via FTP or file manager. Go to public_html > wp-content and look for the folder named plugins. Then rename that folder to anything you want. Doing this would blind WordPress’s directory lookup and would render the plugins deactivated.

 

Another is Via phpMyAdmin

Of course, the FTP method is the best way for most people. But that doesn’t mean  there’s not other way. Going to your database is always an option.

First you will need to login to your web hosting dashboard. In this example, we are showing you a standard dashboard. Your hosting account’s dashboard may look different.

You will need to go on phpMyAdmin icon under the ‘Databases’ section.

This will redirect you to your phpMyAdmin in a new browser window. You will need to select your WordPress database, if it is not already selected. After that you will be able to see WordPress database tables.

Please take note that the prefix ‘wp_‘ is just a standard for WordPress. Your tables may have a different prefix. You need to click on the wp_options table. Inside wp_options table you will see rows of different options.

Go look for the ‘active_plugins‘ and click ‘Edit‘ and paste the following to it.

a:0:{}

Success! Deactivating the plugins either via phpMyAdmin or FTP, would give WordPress it’s standard runtime without getting the codes from the plugins, thus fixing the Error 500

 

What you want to do by now is figuring out what plugin is doing the trouble. Simply reactivate one plugin at a time until you find the one that caused the issue. Get rid of that plugin, and report the error to the plugin author.

Re-upload the core files

If the above process does not work, then try re-uploading the wp-admin and wp-includes folder at your server. Take note that this is your website that you’re tweaking and a simple mistake could be fatal. Always make sure that you have a backup of it every now and then.

This will NOT remove any of your information, but it may solve the problem in case any file was corrupted.

 

4. Look at your server error log

If the most of the above still don’t work for you, then this might be. This is the practice that I am doing every now and then and works all the time.

Looking on your website’s error logs is the best way, you’ll find what’s wrong and therefore give you proper ways to fix things. Simply connect to your server via ssh.

Connecting to your server matters on what device your using. If you’re using mac, then simply open the terminal and type the following

ssh [email protected] port

Take note to change ‘yourIP’ with your server’s IP address and ‘port’ to the proper ssh port, the default value is 22.

If you’re using windows you can either activate the ssh to apply on the command line or download and use PuTTY. Here’s a post on how to connect to your server via PuTTY.

Once logged in you should be under the ‘public_html’ folder, type the following command:

nano ../log/error.log

or

journalctl

Take note that the command varies with your servers operating system. Doing this would display to you an error log that tells what’s wrong with your website. It could be either with your code, the apache or anything else.

 

All in all, the 500 Internal Server Error is a very general HTTP status code that means something has gone wrong on the website’s server, but the server could not be more specific on saying to your browser what the exact problem is. Looking to your own logs would solve it.

4.1 Or ask you hosting provider

If you don’t have root or sudo access to your server, or simply don’t want to dig on the technical side, then you need to get in touch with your hosting provider. By looking at the server logs, they should be able to get to the bottom of things.

These are all the possible solutions (to date) that may fix the internal server error problem in WordPress. Hope this fixed your website along with your day.

Know something that we don’t? We’d love to hear from you! Feel free to create or join the conversations at the comments below! And we’re going to make sure that this articles’ up to date with any new stuffs from our users.

 


Feeling social? Follow us on Twitter and Facebook.


Sponsored: Want to have your Dream car?

Comments

comments

Joenathan Dave

Dave is a young, fresh from college guy that loves the Geek & Tech. He is the Founder of The Davessa Blog and all its domain. Programming, Web design, Game Development & WordPress is his hobby. Ideas, thoughts and any tip? Reach him at [email protected]