500 Internal Server Error WordPress – How To Fix 500 Error


If you are facing 500 Internal Server Error for your after migration from one server to another, I can give you Guarantee, no one will show you the right way. Some will blame the Web Hosting and some the .htaccess. Unfortunately, most does one understand one major point – one blog which was active without any 500 Internal Server Error, why the hell it will show 500 Internal Server Error�when you are changing only the web hosting service.

 

Understanding why 500 Internal Server Error occurs in WordPress after the migration

 

Most of us simply copy-paste the whole …/public content either through FTP or Tar it, download to the new server using the Shell and untar it, restore the MySQL from the old to the new, change the name-server (s) and done. Three steps, for a good host like Rackspace, everything takes hardly a day. Then why the hell this 500 Internal Server Error occurs suddenly ?
500 Internal Server Error can happen in the following cases :

 

Corrupted .htaccess – In this case 500 Internal Server Error will happen ALWAYS, not randomly.

File Permission Problem – Unusual for server migrations, you have to CHMOD to change the file permissions, you will get the default file and folder permissions in WordPress codex.

Less allocated php memory / default php memory – This is the commonest and almost always “undiagnosed” reason for random 500 Internal Server Error after server migration.

 

What is random 500 Internal Server Error ?

 

You website or blog opens rightly at one moment and at the next moment when you try to open xyz page or post sudden it shows 500 Internal Server Error. If you refresh the page, it loads rightly again.

 

Fixes for the 500 Internal Server Error

 

Corrupted .htaccess – Try with “default” clean .htaccess file. I have kept default within quotation marks as, unless permalink structure is activated, WordPress needs no .htaccess. Random 500 Internal Server Error is very less likely to happen with a corrupted .htaccess file.

 

File Permission Problem – Either CHMOD from the shell or on your sFTP / FTP to change the file permissions.

 

Less allocated php memory / default php memory – I will suggest to start with this diagnostic approach for fixing the 500 Internal Server Error. Most probably, you have not increased the php memory with your old server from .htaccess or wp-config. Almost always we forget to change the limit from php.ini (if have ) or the previous hosting provider had configured a higher php memory.

 

To diagnose precisely why this 500 Internal Server Error is occurring, you actually need the access to the error log file, which can be under a folder named log (depends on the Linux Distro and Virtualization Switch). For Rackspace you will find it under :

 

root/www.name-of-your-website--500 Internal Server Error.com/logs/php_error.log

 

PHP memory is by default 32 MB, which is practically nothing if you are using XML Sitemap generator, some SEO etc. and you have around 2K posts, the php memory will simply exhausted and throw 500 Internal Server Error.

Simply look if there are anything saying “memory limit exceeded allocated…” ; this is the root cause of 500 Internal Server Error. It is not those plugins responsible for 500 Internal Server Error directly, but the limit of php memory is calling the 500 Internal Server Error to happen and you can easily fix it through .htacess and / or wp-config file.


For Rackspace, there is no limit up to what you can increase this php memory. There will be no limit for the Servers who calculates the consumption as Computing Cycles. You can increase to few GB (you have to mention as MB).

In order to increase the php memory, to get rid of random 500 Internal Server Error, you can add this to your .htaccess file (in the root) :

php_value memory_limit valueM

 

Change the red colored word value to to your desired value.

 

Importance : It obviously solves the random 500 Internal Server Error due to insufficient php memory. �This value of php memory is distributed for all the files under the folder (root of your website in this case) including WordPress. If you have a subdomain, that will share it and might throw 500 Internal Server Error as the memory actually not increased much in real. For example, in your main folder there is WordPress (default php memory 32 MB) and in sub- there is another WordPress (32 MB again), if you increase the php memory to 64 MB from the .htacees in the root of your website, you will get 500 Internal Server Error again! Simply because the 64 MB is divided in to 2 x 32 MB. So to solve this 500 Internal Server Error in your case you will need a value > 64 MB.

 

Changing php memory from wp-config to solve the random 500 Internal Server Error :

 

in wp-config.php, you need to add :

 

define(‘WP_MEMORY_LIMIT’, ‘valueM’);

 

Change the red colored word value to to your desired value.

 

Importance : This is specific for the WordPress installation under question showing random 500 Internal Server Error.

Changing from php.ini : It is better to ask the hosting provider before manipulating php.ini.

 

More on random 500 Internal Server Error

500 Internal Server Error WordPress - How To Fix 500 Error

If increasing the memory to practical value does not solve the 500 Internal Server Error, there is probable issue with sql database (as we are talking about migration). Again, look what error is showing on the error log. If the 500 Internal Server error is due to any specific plugin, deactivate, delete it, clean the database and then the plugin again. You will not get 500 Internal Server Error anymore.

Sometimes, hacking attempts can throw 500 Internal Server Error. This is due to the fact, the hacker has injected some code and that is eating up the php memory. PHP log will show the problem.

Signature


Incoming search terms:

wordpress 500 error,Fix WordPress After Update,wordpress error 500,500 internal server error wordpress,wordpress change hosts 500 error,wordpress 500 server error,wordpress 500 internal server error fix,wp better security internal server error,wordpress 500 eror,what is wordpress error 500,VPS wordpress 500 Internal Server Error,vps optimized internal server error wordpress,wordpress error 500 after changing site root,wordpress error after general-template php update 500,wp 500 error,wordpress repair database 500 internal error,wordpress plugin 500 internal server error,wordpress options-general php internal server error,wordpress menu 500 internal server error after changing domain,wordpress internal server error only on homepage
0saves
If you enjoyed this post, please consider leaving a comment or subscribing to the RSS feed to have future articles delivered to your feed reader.
About Abhishek

Abhishek Ghosh is an Orthopedic Surgeon, Inventor with 216 Patents, Current editor of The Customize Windows Media Group. You can follow and know more about Dr. +Abhishek Ghosh on Google Plus and follow on Twitter as @AbhishekCTRL.

Trackbacks

  1. [...] server is actually running on the same physical server and using the same physical resource. MySQL has gone away, 508 resource limit reached messages are quite common due to increased number of plugins which are [...]

  2. [...] It is not a funny thing to get your MySQL database having a huge overhead, you might get infamous MySQL Gone Away error or 500 Internal Server Error. It happens with any version of WordPress and neither WordPress nor the Akismet plugin itself, my [...]

Speak Your Mind

*