Ways To Increase PHP Memory Limit In WordPress Easily
Increase PHP Memory Limit In WordPress: WordPress is most popular blogging platform. If you are using WordPress, its very common to get errors in WordPress. During my blogging journey I have come across different types of errors. We usually get frustrated and we loss our valuable time in fixing these errors. So I decided to write articles covering all WordPress errors I ran through till now. I have already covered article on how to fix error establishing a database connection in WordPress and internal server error. Next is about how to fix Memory Exhausted error in WordPress. Sometimes WordPress Memory Exhausted error shows up while activating a new plugin or during WordPress update or even when you are doing some other tasks in WordPress. The error looks like:[php] Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 2348617 bytes) in /home/xxx/public_html/wp-includes/plugin.php on line xxx
The reasons for this error is that you have exceed your default Memory Limit. Means PHP Memory Limit of your host is less than what that particular process requires to performing its functions. Now to fix this memory exhausted error you need to exceed default php memory limit of your host.
In this article I will be sharing the best as well as easy ways to increase PHP memory limit in WordPress.
5 Ways To Increase PHP Memory Limit In WordPress
Now I am going to share 5 different ways to increase PHP memory limit in WordPress for fixing memory exhausted error. You can use any of the following methods.
Increase PHP Memory Limit Via PHP.ini File
If you are on shared hosting you would probably won’t have access to php.ini file. But most of them allows you to create duplicate php.ini file in your WordPress directory. The duplicate php.ini values will automatically overrides your default php.ini values.
To increase php memory limit using php.ini you need to create a blank text file with the name php.ini and add the following lines in it:[php]memory_limit=64M[/php]
Now save the file and upload it to /wp-admin/ folder using FTP. This will increase your default php memory limit to 64 MB and most of the times memory exhausted error is fixed.
Increase PHP Memory Limit via Wp-Config.php
You can also increase memory limit just by editing wp-config.php file. This is indeed the easiest method. Open wp-config.php located in your wordpress directory. And then add the following line inside main php tag:[php]define(‘WP_MEMORY_LIMIT’, ’64M’);[/php]
Adding this line inside wp-config.php will increase your PHP memory limit to 64 MB. With this check if memory exhausted error is fixed.
Increase PHP Memory Limit By Editing .htaccess
You can also increase memory limit by editing .htaccess file in your WordPress directory. Just add the following line inside .htaccess[php]php_value memory_limit 64M[/php]
This will increase your php memory limit to 64 MB and you should be able to fix memory exhausted error. Note: Care must be taken while editing your .htaccess file as little bit of error will damage your WordPress site.
Increase PHP Memory Limit Via install.php
In this method you need to edit your install.php file inside wp-admin folder of your WordPress installation directory. Add following line in install.php file:[php]ini_set(‘memory_limit’,’32M’);[/php]
Hope your memory exhausted error should be fixed.
Contact Your Hosting Provider
If you don’t want to mess with these codes you should contact your hosting provider for assistant. And get the necessary changes done. Hostgator and Siteground are the two that offers live chat support. And that’s why you would be assisted in a few seconds. Of the two I like Siteground support as you don’t need to wait to get started with chat. As far as Bluehost is concerned, it doesn’t offer live chat support but you can call Bluehost using their toll free numbers. Bluehost really offers quality support.
You must use any one of the method listed above and don’t mess with the codes. If you know any other way to increase PHP memory limit please let me know. If you found this article interesting do share it over social media. For queries and feedback do leave a comment and also do subscribe for updates.