Easiest Ways to Increase the WordPress Memory Limit

10 Jan, 2024

WordPress is one of the most flexible and limitless Content Management Systems. You can customize WordPress by installing various themes and plugins and make your site suitable for your requirements.

You see the endless possibilities, don’t you?

However, too much power can be dangerous; yeah, not always, but sometimes. I get that.

In this case, imagine you have installed so many WordPress plugins. Do you know what will happen then? The more WordPress plugins you install on your WordPress admin, the more memory power to smoothly process the plugin’s operations.

Otherwise, do you know what will happen? Eventually, your WordPress website will become slow. Ah, I’m not too fond of that. I’m sure that you also will not like a slow website.

And the reason is, WordPress is now lacking the memory required to run all of these plugins and customizations you have made.

If the plugins require contacting external services to process their functionality, the slowness maybe even more frustrating.

But that doesn’t mean that you should stop using plugins. So what is the solution now?

The solution is simple to execute. We will increase the PHP Memory Limit based on our new requirement. And here, I’m going to show you how you can increase the PHP Memory Limit very quickly.

Increase PHP Memory Limit From DirectAdmin

The PHP Memory Limit for your WordPress website can be increased quickly from the DirectAdmin control panel.

If Rovity hosts your websites, then this is the simplest solution.

Okay, now please log into your DirectAdmin control panel and click on the Select PHP Version icon. It will be under the Extra Features category.

Select PHP Version DirectAdmin

You will now see the Select PHP Version screen. Here click on the Options tab.

You can choose your preferred memory_limit value from the drop-down menu, and your changes will be automatically updated.

Memory Limit DirectAdmin UI

That’s pretty cool. I told you this is the easiest way to increase your PHP Memory Limit in your DirectAdmin control panel.

Now let me tell you once again. This feature is available to Rovity’s customers. Suppose Rovity does not host your website. In that case, you may/may not have this feature already available with your current host.

Most of the cPanel based hosts will be offering this feature, so I suggest you double-check with your hosting company.

Unfortunately, suppose you don’t have this option available. In that case, I will show you some other methods to increase your PHP Memory Limit.

If your website is hosted with Rovity and you don’t see this option or this option is not working for your website, please get in touch with our customer care support team.

Our experienced support team can then check this for you.

Edit WP Config File to Increase PHP Memory Limit

Suppose you don’t have access to the graphical user interface method. In that case, you can increase your PHP Memory Limit by directly editing the wp-config.php file.

You don’t need to worry. This is a single line of code. You need to find the file and paste it inside there.

You need to log in to your DirectAdmin control panel or FTP and then navigate the wp-config.php file.

In this example, I will use DirectAdmin File Manager, and it is so easy to work instead of using FTP.

This wp-config.php file will be in the root folder of your WordPress installation directory. Once in the WordPress root directory, find the wp-config.php file and double-click on it.

Now, you can open this file in DirectAdmin’s File Editor feature. You can directly edit this file to make the changes live.

Now copy-paste this below line into the wp-config.php file.

define( 'WP_MEMORY_LIMIT', '128M' );

If this wp_memory_limit variable is already entered there, you need to increase the value from 128M to 192M or whatever you wish.

Add WP Memory Limit WP Config File

You need to make sure that you are placing this code above /* That’s all, stop editing! Happy publishing. */ line.

When you have finished, click Save. Your changes will be live on your WordPress website immediately.

Edit .htaccess File to Increase PHP Memory Limit

You can increase the memory limit by editing the .htaccess file as well. This is an alternative method to the wp-config.php file edit. So in most cases, you either need to edit only in one place.

The .htaccess file is a critical server configuration file not just needed for your WordPress website.

With the .htaccess file, you can manage so many aspects of your website, whether it’s a WordPress website or a regular website.

For example, suppose you are using a cache plugin. In that case, that plugin will store its configuration in this .htaccess file instead of the WP Config file.

Tier 1 Network Partners. < 30ms Global Latency.

Get access to our vibrant CDN for FREE and have a blazing fast website next to your customers; wherever they live.
In India, we have PoPs in Bangalore, Chennai, Mumbai, and New Delhi.

You can edit the .htaccess file the same way you edit the WP Config file. You can use the DirectAdmin control panel’s File Manager or your FTP to update the .htaccess file.

To begin, go to the File Manager of your DirectAdmin account and then access the root directory of your WordPress installation. In most cases, it will be the public_html folder.

I hope you can easily find the .htaccess file since it will be mostly the first file in your WordPress directory structure.

So here, double-click on the .htaccess file, and then the edit window will open for you.

Now please copy the code below and paste it into your .htaccess file.

php_value memory_limit 256M

Please be sure to paste the code just below the # END WordPress line, as you see in the screenshot below.

Add PHP Value Memory Limit Htaccess File

Once you save, just hit the Save button, and the .htaccess file will apply your changes instantly to your website. You will now have an increased PHP Memory Limit for your WordPress website quickly.

That’s it for this tutorial. I hope you will find this is helpful to increase the PHP Memory Limit for your WordPress website.

Suppose you are looking for a cloud-based web hosting service that makes your website faster and easier management. In that case, I strongly suggest you try Rovity.

I am sure that you will love Rovity and the hundreds of premium features we offer to make your website management more efficient.

Jafar Muhammed

Jafar Muhammed has 10+ years of experience in WordPress, web hosting, domain names, DNS, CDN, server administration, etc. He is an open web advocate. He is the CEO of Rovity, the fastest-growing premium shared hosting startup in India.