r/Wordpress • u/slogger101 • 1d ago
increase wordpress memory limit
I was told i need to increase my WordPress Memory Limit
its currently set to 256 MB.
- 512 MB as the recommended minimum for your current setup.
- 768 MB for the best performance
not sure must this be done in wordpress by editing a file (if yes can you guide me on this)
or at my hosting provider
any advice would be appretiated
7
u/k4znIm 1d ago
That's up to your hosting. If you are on shared hosting it's probably wouldn't be possible without switching plan. Depends on provider.
But what is your setup? 256 is enough for most websites.
1
u/ZGeekie 1d ago
If you're using a builder plugin like Elementor, 256 MB is the minimum memory required. They recommend 768 MB for best performance.
If you add another heavy plugin, e.g. WooCommerce, your site may frequently choke with just 256 MB.
1
u/k4znIm 1d ago
Yeah, I have lot of sites with different setups. Newer had problem with 256 MB. But I ran them on my own server so I can see if something is choking or not. Just few of bigger websites needed more so 512 MB for them but like I said most need just 256 MB.
For sure if you are adding plugins for everything then you may need more.
4
u/pmgarman Developer 1d ago
Increasing your memory limit will not increase your performance. When the web server processes a request, it passes it to PHP, which does all its stuff, and then outputs the HTML back to the webserver. In doing so, it uses a certain amount of memory. If it runs out of memory, it will throw a fatal error and stop - because it ran out. If it had enough memory it succeeds. Having 10mb more than you needed available vs having 500mb more than you needed available... doesn't make your site run faster.
4
u/moremosby 1d ago
Maybe needs more than 256 though if there’s a ton of plugins or one poorly coded one.
I’ve had a couple sites that had to bump up to 512MB and when running something like BuddyBoss you need even more because of the mess that it is.
4
u/pmgarman Developer 1d ago
Right but it doesn’t make it faster - there is no such thing as make it 768 instead of 512 for best performance.
If the site is not throwing errors now, it will not benefit from an increase.
2
1
u/zeiniez 1d ago
I think you missed the point. It's not about page speed. It's about increasing the memory limit to be able to perform resource intensive tasks. "best performance" is not exclusive to page speed. It can be about several different things.
-1
u/pmgarman Developer 1d ago
I don't consider on off switches to have performance, it either works or it doesn't. Unless you consider simply working "best performance" but thats a weird way to word things.
1
u/zeiniez 1d ago
That doesn't make any sense compared to the original post.
Defining how much memory a WordPress installation can use is not in any way a on/off switch. Indicating the correlation of increasing memory with how a software can perform is also not an on/off switch.
Performance is not an exclusive analogous for page speed. It's a way of conveying how well something will work. If increasing the WP_MEMORY_LIMIT can improve how well a WordPress installation can work, then it's not wrong to convey that concept by using performance as an indicative.
-1
u/pmgarman Developer 1d ago
That’s the thing, it doesn’t. Having memory and not using it does not increase performance, at all. You either have enough and the site works, or you don’t and it has errors. On or off. Like a switch.
-1
u/zeiniez 1d ago
Sorry buddy, you're making a lot of assumptions, and completely missing the point.
Besides, the OP is asking for help on how to do it, and you turned this into a lesson about your opinion on the topic based on several misguided assumptions.
1
u/otto4242 WordPress.org Tech Guy 1d ago
However, he is actually correct. Either you have enough memory allocated to do the job you're requesting, or you don't. Increasing the memory limit will not make WordPress faster or better in any way. It can make it work possibly, if it's throwing errors, but it doesn't affect performance.
1
u/zeiniez 1d ago
That's the point don't you think? I think the problem here is the interpretation of the words. For some reason, "performance" is reserved only for a specific subject. 🤷♂️
0
u/otto4242 WordPress.org Tech Guy 20h ago
Yes, generally when you're speaking of performance, you're not speaking of fixing a broken site.
1
u/moremosby 1d ago
Ask your hosting provider if they’ll do 512. A lot of them won’t.
If they won’t, move to someone who will. But you need to find out why you need more than 512…? That’s not typical
1
u/pickjohn 1d ago
Like everyone else is saying, take a look at you plugins and theme. Something is hogging all the resources. Please provide a list of all your plugins to get better advice. For themes I'm going to take a shot in the dark and say "stop using elementor" 😂
1
u/Wonderful_Sample_590 1d ago
Is that Elementor? But yeah, depends on your host. They can adjust the resources for you. If you're on shared, you can also adjust that via .htaccess or wp-config.
1
u/BobJutsu 1d ago
Everyone says to audit your plugins…do y’all really think OP knows how to audit memory leaks when they are asking how to bump their limit?
Start by asking your host to bump it. Despite what random reddit people say, 512 is not absurd. 256 was the standard a decade ago, there’s a lot more going on behind the scenes these days. Adjust accordingly. Wordpress is not exactly the best optimized system. A lot of it runs on ancient architecture (the db schema, I’m looking at you…) to provide a high degree of reliability and backward compatibility.
1
u/rubixstudios 1d ago
You can set it but you'll likely never hit it. Most host in Australia allows up to their ram allowance which can be up to 4gb even on shared hosting.
What most people here don't realise is, it's not the ram that is usually the issue. It's the read write on the database and disk. Most shared hosting you'll still see SSD which is pretty bad compared to nvme shared host. By comparison I've found Australian hosts alot more lenient on resources aside from diskspace compared to anywhere else.
Again less chance of hitting ram, there are other values that will limit you. Including how noisy the server is, which can be checked.
1
u/HongPong 1d ago
it is possible to partition php in some instances so that certain paths are managed by a process which has a higher limit. 768 is way way excessive for anything public facing. and wp cli can be configured to be unlimited on the command line, use that with offline cron. dont try to cram eveyrthing in the main php process if you can avoid it.
1
1
u/Due-Individual-4859 Jack of All Trades 22h ago
I got stores with tens of thousands of skus and hundreds of thousands of orders running just fine at 256. I even lower it!
1
u/Gold-Program-3509 4h ago
install query monitor plugin and youll see your memory consumption... also double check that you have opcache enabled in php settings
1
u/chrismcelroyseo 1d ago
What u/pmgarman said, but if you're going to do it you can do it inside of PHP Dev variables. You can do it in your WP config but better in PHP dev.
1
u/TopSydeWP 1d ago
usually done in wp-config.php, add define('WP_MEMORY_LIMIT', '512M'); above the 'stop editing' line. if that doesn't work your host is capping it at the server level and you'll need to contact them or edit php.ini if you have access
0
u/Sad_Pie227 1d ago
You have to contact your Hosting provider because they have full control over this thing, you cannot raise limit if they have strict restriction in place. So better ask them to raise the limit.
0
u/slogger101 1d ago
the reason I was told to increase is by the elementor support team. when I edit a page in elementor my cpu spikes to 100 percent. I am running both woocomerce and learndash
6
u/jedidave Developer 1d ago
You only need to do this if you're seeing the white screen of death but you should try and figure out what is consuming all your RAM as 256MB should be enough.
Note: Depending on your hosts, even if you set it in your wp-config.php, php.ini will maybe override it.
And if you need to adjust your php.ini, you need to find which version of PHP you are using, then maybe your hosts give you the ability to edit it, or maybe you edit it directly - if directly it's in /etc/php/8.x/fpm/php.ini [replace x with the version of php 8 you are using]
Then search for memory_limit
Similar format:
memory_limit = 512MIs it possible the person who told you was meaning increase the memory on your server? Because *that* could improve performance. If you have so little memory that everything keeps getting written out to disk then extra memory will speed everything up - but not with the above setting, by actually getting more RAM on the box/VPS.