Where is memory_limit and wp_memory_limit set?
-
Hi guys,
I'm a little confused and could use some help. I feel like this may be something obvious that I'm just not seeing right now.
I was trying to make sure all my sites have 256M for wp_memory_limit (to meet a recommendation from a plugin), and I see from the documentation that that value is automatically set to match the memory_limit value in /app/data/php.ini. However this is not the behaviour I see at all.
In my /app/data/php.ini, the memory_limit is set to 128M, but WordPress shows 256M still. Why? I Mean this is the value I want, but I don't understand how it's set at 256M already when I never set it to it. At first I thought this may be related to the resources allocated to the app itself (the WP app had 256 MB assigned) and I tried increasing to 512 MB and 1 GB as a test, and it still showed 256M as the wp_memory_limit, despite memory_limit in php.ini still set as 128M and the Cloudron app itself being allocated 512 or 1 GB, so this doesn't seem related at all to the actual app memory, but I can't figure out where it's coming from still since it doesn't match what's in the php.ini file.
Any ideas where this 256M is being used? I even tried to find it by doing a grep in /home/yellowtent/appsdata/*/data/php.ini but can't actually see 256M set anywhere, even if not looking specifically at the php.ini file using grep - still nothing. I also tried searching in git.cloudron.io for the various WordPress apps, but couldn't find this mentioned anywhere in the repository. I also checked the .htaccess file and wp-config.php file, still nothing showing 256 set anywhere.
Screenshot from the WordPress Site Health tool showing the 256M value for memory (ignore the high 1G values for max sizes for posts and files, I intend on changing all of those soon, it was for one site with very large media files, haha):
-
Hi,
actually it seems our documentation for the app is outdated when it comes to the memory setting. Especially the unmanaged wordpress flavor does not automatically adjust the memory limit according to the limit set from Cloudron. So to set this explicitly you have to overwrite the default (256MB) to your intended value.
To do this add the following line to the config file at/app/data/public/wp-config.php
define( 'WP_MEMORY_LIMIT', '256M' );
Have to check if it makes sense to adjust this automatically or fix the documentation.
-
@nebulon Interesting, okay. Good to know. My preference would be the same behaviour as the managed WordPress app, where it just uses the same value set in php.ini. I assume that'd help keep things more straightforward.
Odd that it chooses 256M by default (I assume that's what it does, because there's nothing set at 256M in the files).
-
@nebulon Is it possible to configure WordPress Unmanaged to just reflect the settings in php.ini? Seems odd it wouldn't be mapped to that when it picks up other php.ini changes such as the max upload size, etc. I'd prefer not to have to update memory in two different places when it seems avoidable.
-
@girish I don’t know if that’s really accurate. I say that only because according to the WordPress server status page, it shows my memory set at 256M, but I don’t have that set anywhere in any files. And when I assumed it was matching the memory assigned to the whole app deployment, it was not excuse when it set it to 1 GB as a test, it still showed 256M.
-
-
FYI - related discussion: https://forum.cloudron.io/topic/5960/setting-memory_limit-dynamically-in-wordpress-developer-package
-