Sunday, December 29, 2013

Hot to increase PHP Memory Limit In wordpress

you are going to see an error which reads “fatal Error: Allowed memory Size of xxxxxx bytes exhausted” both on your browser or server logs.


frequently, this occurs while you install a new plugin, upgrade to the newest WordPress version or do different task.


For this reason that you get this error is the insufficient memory allotted to WordPress and to get rid of this error you want to increase PHP memory limit of your WordPress weblog.


in this put up, i’m going to show you methods to check and raise the default memory limit when it will get exhausted.


how you can test PHP Memory Limit?


the most typical method to check the reminiscence restrict for PHP scripts is to create a PHP file to your server like php-info.php and put the next code in it.


 


<?php phpinfo(); ?>

after Make  this file on your server, simple open it for your browser e.g.www.yourdomainname.com/php-info.php . here you’re going to see a table record containing all configuration information about your current PHP environment (including memory Limit).


Increase PHP Memory Limit In WordPress


 


By default, the maximum memory limit for WordPress core is 32 MB but if you are using too many plugins on your WordPress blog  you probably need 64MB or more memory in your wordpress blog.


If you dont have idea how much memory you need, make use of WP-Memory-Usage Plugin and look out for the memory usage bar. If you find it RED try to increase the maximum memory limit until it shows up in BLUEcolor.


1. Increase Memory Limit From php.ini


Easiest  way to increase memory limit is to edit the php.ini  file on your server. However, most small shared hosting servers won’t give you access to this php.ini file.


But if you have access to this file simply follow these steps:


  • Find the location of php.ini on your server by creating php-info.php file as mentioned above.

  • Search for “memory_limit” in php.ini and change its value to 64 M or 128 M. In case, there is no “memory_limit” found, add the following line at the end of php.in – memory_limit = 64M;

  • Save it and restart your Apache server with command line – httpd restart in your server

2. Edit Your .htaccess File


A fresh WordPress Installation won’t have a .htaccess file so you need to create it yourself on your wordpress directory. In case you already have it for some reason just put the following line in it and save the htacess  file.



php_value memory_limit 64M;

 



By adding this line in your .htaccess file the memory limit will now be 64 MB. In case, you want more just replace 64M with 128M and you’re done. ;)


3. Change Memory Limit in wp-config.php


In this Way , you don’t need to create a new file or edit any line . Just adding the following line in your “wp-config.php” file would increase your PHP Memory Limit to 64 MB.



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

 



 



Hot to increase PHP Memory Limit In wordpress

No comments:

Post a Comment