1

I've read here, but I want to ask if I have understood this correctly.

We have a server in which WordPress admin needed more memory. The PHP memory_limit, in PHP.ini, is set to 256M, and so was WP_MAX_MEMORY_LIMIT in wp-includes/default-constants.php. There is a large amount of pages, and I think we will end up automatically delete pages that are older than a certain treshold, but as a quickfix I increased the memory.

I set the WP_MAX_MEMORY_LIMIT to 512M, and that works. The way I understood the documentation is that WordPress will be allowed to use 512M instead of PHPs memory_limit, which is set to 256M.

So, is it right that WP_MAX_MEMORY_LIMIT overrides PHPs memory_limit? It is able to use more memory than PHP is configured to use?

It certainly seems that way on our server now, but I want to be sure it is not something else going on.

EDIT: According to this answer, I can set the wp memory within the limit of php.inis limit. But that doesn't seem correct.

2

The true maximum is ultimately up to the host - they can impose whatever limits they wish. But even so, you can try with WP_MEMORY_LIMIT, which is the memory limit WordPress sets at runtime for any given request.

WP_MAX_MEMORY_LIMIT is only applied in certain situations, either for administrators in the backend (users with the capability manage_options), or for image resizing/other intensive operations.

  • I used WP_MAX_MEMORY_LIMIT because I only need this in admin mode :) But I am correct in saying that WP_MAX_MEMORY_LIMIT is the actual limit, as long as it is larger than memory_limit? – ptf Jul 12 '16 at 14:06
  • I also did an edit to the post at the bottom :) – ptf Jul 12 '16 at 14:08
  • WP_MAX_MEMORY_LIMIT is just a value (default 256M) that WordPress uses to ini_set( 'memory_limit' ) for administrators in the backend. If you want to know how exactly PHP handles memory, limits, INI files and runtime ini settings, you're much better off asking on Stackoverflow/PHP-specific channels. – TheDeadMedic Jul 12 '16 at 15:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.