Table of Contents Hide
How to Increase PHP Memory Limit in WordPress – When you add more plugins, update plugins, and upgrade WordPress to the latest WordPress version, it is very likely that you will face problems with memory size or what is often called Memory Limit. And it is a common problem that often occurs. The reason why this error appears and befalls you is because you exceeded the default Memory Limit provided by your hosting server.
If you are experiencing memory limit problems while on your WordPress site, then in this article I will provide some solutions to solve this problem. You can try one by one each of the solutions below until you find the right one to solve your problem, because there are many ways to solve it and sometimes one works and one doesn’t work for you.
How to Increase PHP Memory Limit in WordPress
The first thing you need to do is stay calm and don’t panic. Next you need to do is require higher PHP memory. Memory limit errors are usually shown as follows:
Fatal error: Out of memory (allocated 30408704) (tried to allocate 3981531 bytes) Fatal error: Out of memory (allocated 8388608) (tried to allocate 28672 bytes) Fatal error: Out of memory (allocated 49545216) (tried to allocate 77824 bytes) Fatal error: Out of memory (allocated 32016932) (tried to allocate 25152 bytes) Fatal error: Out of memory (allocated 8126464) (tried to allocate 196608 bytes)
1. Edit the php.ini file
If you have access to the php.ini file, you can immediately open it and adjust the php memory limit. On the other hand, if you don’t have access to php.ini, you can create a new file for you to upload to the file root directory on your WordPress site. All you have to do is open notepad, and type memory_limit = 64M and then save it as php.ini. Once you have done that, you can simply upload it to the root directory of your WordPress site via ftp.
2. Edit wp-config.php
One of the most popular ways to increase memory is through the wp-config.php file, because the php.ini file is a very important file and of course very sensitive for you to work with. The wp-config.php file, on the other hand, can be more secure. All you have to do is add define (‘WP_MEMORY_LIMIT’, ’64M’); in your wp-config.php. You can change 64M to different sizes, such as 128M, 256M, 512M, etc.
3. Edit the .htaccess file
For this method, maybe some people don’t work. Some have been successful and others have experienced an Internal Server Error, but don’t worry, if you have a server error after adding the code, you can delete it. Now, to increase php memory usage via .htaccess, you will need to access it via ftp, and then you will see a file called .htaccess, all you have to do is add 64M php_value memory_limit in the .htaccess file.
4. Edit the install.php file
The function of the code used for this one is the same as the one entered in the php.ini file. All you have to do is to open the install.php file which is in the wp-admin folder, and then add this code ini_set (‘memory_limit’, ’64M’); .
5. Consultation with a hosting provider
If all of the above fails, it may mean that the hosting you are using is not possible to increase your php memory usage, then you should ask your hosting service , and ask them to upgrade the memory for you.
Remember, always back up sites or files before making any changes. And those were some ways to increase the PHP memory limit on WordPress. Hopefully this article was useful and helped solve the memory limitation problem that occurred to you. Good luck 🙂