Increasing the memory limit in WordPress is an important consideration for websites built with WordPress. The memory limit determines how much memory your WordPress website can use to perform tasks such as running installed plugins and processing queries, handling requests from visitors, etc. If the RAM limit is low, your site may experience slowdowns and even crashes due to insufficient resources. The default memory size is usually between 128MB and 256MB, but this can vary depending on your hosting provider and the type/size of your web hosting plan, among other factors.
Finding the WordPress Memory Limit
Before starting any procedures, we need to find out how much memory limit is being used on our server. We can do this using two simple methods. Let’s create a new TXT file and name it “ramlimit.php” (you can choose any name you prefer), and make sure to set the file extension to “.php.” In this file, add the following code: . Upload this file to your website’s root directory using an FTP program or CPANEL. Now, in your web browser, type the following: yourwebsite.com/ramlimit.php. Search for “memory_limit” to see the relevant screen.
Before starting the operations, we need to find out how many MB (Megabytes) is the Memory limit limit used on our server. We can find out with two simple methods. Let’s open a new TXT file, write the name and extension “ramlimit.php” in this way. “ramlimit” I wrote this name myself, you can give the name you want. Do not forget to make the file extension PHP. Add the following code into the file you created; < !–?php phpinfo(); ?–>. Add this file to the root directory of your site with the FTP programme or via CPANEL. Now let’s write it in our web browser as follows; siteadi.com/ramlimit.php . To see the related screen; search for memory_limit.
Increasing WordPress Memory Limit
Using the two methods explained above, we have now learned the RAM limits of our WordPress installed server. Now, let’s proceed with increasing the default memory limit. The following three methods can be used, and you can choose whichever one seems easier to you:
a- Increasing Memory Limit in wp-config.php File:
Connect to your website’s root server using your FTP program. Add the following code to the wp-config.php file: define(‘WP_MEMORY_LIMIT’, ‘256M’);. In this example, I used 256 as the value since my server has 2 GB of RAM. You can adjust the value according to your own server. For instance, you could use 512M. After making this change, the memory usage limit increased from 256M to 512M.
b- Increasing Memory Limit in .htaccess File:
Using FTP or CPANEL, go to the root directory where your website files are located and add the following code to the .htaccess file: php_value memory_limit 64M
c- Increasing Memory Limit via cPanel:
Login to your CPANEL provided by your hosting company. Under the Software section, click on ‘MultiPHP INI Editor.’ Choose your website name from the options. Look for the memory_limit section in the PHP INI Basic settings configuration. Update the value according to your server infrastructure.
If you are still encountering WordPress memory errors after trying these methods, it might be beneficial to contact your hosting company for further assistance.