If you are facing 500 Internal Server Error for your WordPress 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 folder content either through FTP or Tar it, download to the new server using the Shell and untar it, restore the MySQL database 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 right click 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 access) 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-showing-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 Plugins 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 Cloud 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 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 :
Change the 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
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 install 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.Tagged With wordpress 500 internal server error , WordPress Error 500 , wordpress 500 error , 500 internal server error wordpress , internal server error 500 , 500 internal server error after editing htaccess , wordpress 500 internal error , wordpress http 500 error , wordpress internal server error , wordpress copy database error 500