WordPress is really a marvelous CMS especially for beginners that can run on low configuration web servers until you do not start stuffing it with plugins. Yes, once you enabled multiple plugins on WordPress that begins to make your website slow. More plugins mean more WordPress memory, it’s the same as your personal computer, heavy applications need more RAM (memory) and true with WordPress too.
If you have a limited amount of WordPress memory, let say 32M and when you try to install some plugin or theme that need more than that then either you start getting a fatal error like given below:
Fatal error: Allowed memory size of 23554432 bytes exhausted (tried to allocate 3348617 bytes) in /home4/xxx/public_html/wp-includes/plugin.php on line xxx
Or your site performance will degrade and increased the loading time.
If you search on the internet, how to increase the WordPress memory limit you will get tons of article saying that add a small piece of code in the wp-config file will increase the WordPress memory but it only true if the corresponding PHP memory limit is greater than your existing Wordpress memory. For example, your current Wordpress memory is 32M (Megabytes) and to increase it to the max. 215M you added a code in the Wp-config but your actual PHP memory limit assigned on the server is 128M then it is impossible to exceed that.
So, first, you need to increase the PHP memory limit to get an increment in WordPress memory. If you are working with VPS server then you can do it on your own but for shared hosting users, you need to ask your hosting provider to expand the current PHP memory. However, if you are not sure about the maximum PHP memory you have then here is the tutorial on that.
How to check your current PHP / WordPress memory limit
Method 1#: Hosting Cpanel
- If you have access of the hosting Cpanel then login to that.
- Once you log in, scroll down to the Software section or just find out the option MultiPHP INI editor.
- Click & Open the MultiPHP INI editor.
- Select the website domain to see the PHP settings, if you have VPS or dedicated server hosting then you can also increase the PHP memory limit from here.
- Just front of memory_limit you will find the maximum amount of memory assigned to your WordPress or PHP.
- For shared hosting users like Godaddy, Hostgator or any other they need to ask their hosting provider to increase the WordPress/PHP memory limit. If you just want to check the WordPress memory limit then go to Cpanel.
- Select the PHP version under the software section.
- From the Select PHP version screen click on the Switch to PHP Options.
- Find out the syntax memory_limit and at front of it, you will find the maximum PHP memory your server provides you. In our demo server, it is 128M that means the maximum memory I can assign to WordPress is 128M.
Method 1#: File Manager Cpanel or FTP access.
If you don’t have access to Cpanel of a website but the FTP access is there then you also can find out the maximum assigned memory to your PHP server.
Step 1: Users with Cpanel File Manager access can also follow the below steps by directly accessing the File manager. However, if you don’t have the Cpanel then just connect to the website file directory through the FTP tool like FileZilla.
Step 2: Once you successfully get access to the root directory of the server then go to the Public_html folder where the WordPress files are situated that’s PHP memory limit you want to know.
Note: If it is a subdomain then enter into the folder where all the WordPress files of that particular subdomain are situated.
Step 3: Create a new file and name it
Step 4: After creating a file with the above name and extension open it.
Step 5: Write the below code into the above-created file and save it.
<?php phpinfo(); ?>
Step 6: Now open the web browser and type your domain URL followed by myphpinfo.php. For example, www.xyz.com/myphpinfo.php and you will see all the details of your PHP version installed on your server.
Step 7: Now find the string memory_limit and just in front of that you will find local value and global value. When the local value change it will increase the PHP memory to override the default global memory assigned to the PHP. As you increase the local value it also increases the memory for your WordPress website.
Step 8: After checking the PHP / WordPress memory limit, delete the above created myphpinfo.php file because of security reasons…