500 Server Error - WordPress Login Page - WordPress Memory Issue

There can be many reasons for a 500 Server Error, however, if your WordPress website is loading fine and when attempting to access the WordPress login page (/wp-admin) the reason could simply be an exhaustion of Memory. Even if you have the PHP memory set to a high limit (a minimum of 128 MB, but recommend 196 MB or more if possible) WordPress has its own limit of 40 MB. So this needs to be checked.

You will need to access your WordPress install files and look for the wp-config.php file. You can do so using cPanel File Manager or your favorite FTP Client.

STOP! BEFORE YOU CONTINUE, MAKE A BACKUP OF YOUR WORDPRESS SITE BOTH SITE FILES AND THE WORDPRESS INSTALLS MYSQL (MariaDB) DATABASE. You can never have too many backups. Now with that Warning given, let's move forward.

With FILE Manager (in cPanel) or your FTP program, look for your wp-config.php file in the WordPress web root directory.
NOTE: If you have your site installed in a subdirectory that subdirectory is going to be the web root directory.
On a cPanel server, the web root directory is going to be the /public_html directory. (On some installations for security reasons, you might find the wp-config.php directory outside of the  /public_html directory one level up in the /home directory. This directory cannot be reached via a web browser.

Now, open the wp-config.php file in your editor or the File Manager File Editor and look for this:

/* That's all, stop editing! Happy blogging. */

Right above that (not below it!) add these three lines of code, simply copy and paste in

ini_set('log_errors',TRUE);
ini_set('error_reporting', E_ALL);
ini_set('error_log', dirname(__FILE__) . '/error_log.txt');

Then save the wp-config.php file.

Now go back to the login page that generated the 500 Server Error. This will trigger a /error_log.txt to be written with what is causing your error. In most cases the error will show something similar to this:

PHP Fatal error:  Allowed memory size of 41943040 bytes exhausted (tried to allocate 3072 bytes) in /home/username/public_html/wp-admin/includes/update.php on line 502

If this is what you see, then it is the WordPress Memory limitation and that simply needs to be increased. And here is how to do this.

With the wp-config.php file still open (or open it back up) yoou will need to add the following code:

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

NOTE: You can change 196M to what ever you like, but I would not recommend anything lower than 128M. Before going above 128M you might check with Technical Support (at your web host) to make sure your PHP memory limit is the same.
right above this code in the wp-config.php file:
Now the above file must be placed right above this code:

/* That's all, stop editing! Happy blogging. */

Note: if you no longer need to track this type of error you can just remove the three lines of code that created the /error_log.txt file.

END OF TUTORIAL

If you are a KartHost client and need help with this, feel free to open a Technical Support Ticket. We will be happy to help.

Thanks to Selena Forum Moderator at WPML.org for providing the code above to help us resolve an issue.

Learn More about Managed WordPress Hosting (so you do not have to do things like this) 
Get Your Name as a Domain Name! Register a Domain Name Today!


  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

KartHost WordPress Container Hosting - Clearing Cache

If you are using any of these KartHost products  DIY Self-Managed WordPress Hosting, Manged...

Resetting your WordPress Password

1) At the bottom of your WordPress login form look for and click "Lost your password?" 2) On...

How to update your WordPress Plugins

It very important to upgrade your WordPress install as well as your WordPress plugins. The good...

How to Move Your WordPress Site to a New Server using Desktop Server Pro

If you need to export your WordPress site from one server and import to another server (aka move...

Remove or Add Comments to a Page or Post in WordPress

SORRY No Content at this time, please check back for Updated Informaiton-updated April 2, 2015