WordPress, Memory Usage and Me….
WordPress Hints And Tips
As we add more and more functionality to our WordPress Websites, memory usage on our webservers is becoming an issue.
With some webhosts, it is possible to increase the amount of memory that is allocated to run PHP. In this article, I’ll share how website administrators may increase the memory allocation for their WordPress website.
Please proceed with caution – some Webhosts do not appreciate sites that ‘hog’ memory and this may cause issues if your changes breach the Terms Of Service.
I also recommend that – if in doubt, refer to the Tech Support for your hosting provider or seek professional assistance.
Before we start – Memory Usage
One plugin that will help determine how your system is running is called TPC! Memory Usage. This plugin will show you what the memory usage on your site and the configuration of different areas. The screen shots below will give you an idea of the type of information it provides:
Adjusting WordPress Memory Usage
In the wp-config.php file, add (or modify) the following line:
The above line will set the WordPress Memory limit to 64 MBytes however it can be set at any increment of 8MB. For instance, 32MB, 40MB, 64MB, 128MB.
The wp-config.php file is located in the root directory of your WordPress installation (note, this will differ if you give WordPress it’s own Sub Folder)…..
Once this change is made, the PHP memory_limit will also need to be changed.
Changing the PHP memory_limit
On most shared hosts, I have successfully changed the PHP memory_limit by uploaded a file to my WordPress installation. This file is called php.ini and is a simple text file that contains the following line only:
memory_limit = 128M;
I upload this file to two locations – the root directory of my WordPress installation and the wp-admin folder.
Uploading the file to wp-admin, this forces php to use the different memory_limit for the administration functions of my sites. At one point, on a client site, I found I was having problems activating plugins and conducting admin functions – it turned out to be a memory issue. Uploading php.ini with an increased Memory Limit made it all work nicely.
Remember: If in doubt – speak to your webhosts Tech Support or seek professional assistance before doing this.