As your blog gets more popular among the audiences, it crosses new milestones, out of which the most important and the most loved by the bloggers is the rise in traffic. As you get a hike in the online traffic, blog visitors may start experiencing downtimes and timeouts, especially if you are on a shared hosting (like me! ;)), which may get annoying sometimes and in turn, you may end up losing some loyal visitors.
Increase the WordPress Memory Limit
One of the tweaks you can make to counter this problem, is to increase the memory limit for your server. The wordpress default memory limit is 32MB. This default memory limit can become a problem for your server once your blog gains traffic. To increase the amount of memory limit allowed in PHP, you need to add the below simple line of code in your wp-config file, which is located in the root directory of your WordPress blog installation.
Please note that in the above example, the memory limit has been set at 96MB. You can set anything in the multiples of 8MB; like 64MB, 128MB etc.
Increase the PHP Memory Limit
After you have made the changes for the WP Memory Limit, you also need to make the changes to the PHP Memory limit. For this, you need to edit php.ini file on your self hosted server.
In the php.ini file find the line â€œmemory_limit=â€ and make the changes as below:
memory_limit = 96M
Please make sure that the memory limit for PHP needs to match the wordpress installation memory limit, which in this example we took as 96MB, hence for php memory limit also, you need to keep the value as 96M.
If you donâ€™t have access to the php.ini on a shared hosting environment, then youâ€™ll need to ask your host to increase the PHP memory for your WordPress blog.
What is the maximum memory limit you can set?
If you are on a shared hosting platform, you may not have rights to make the above changes, in which case, you need to get in touch with your hosting provider to increase the memory limit. However, if you are on a self hosted platform (VPS), you can increase it till you are not crossing the limit of RAM on your server.
Using this simple tip, you can avoid most of the memory issues on your wordpress blog. Try this and do share with us how this tip helps you in catering the downtimes on your blog.
In case of any issues while implementing this little tweak, feel free to give a shout! 🙂