Support » Installing WordPress » Difference php_admin_value[memory_limit] and WP_MEMORY_LIMIT in wp-config

  • Alwin


    What is the difference between this 2 settings:

    1 – Setting WP_MEMORY_LIMIT at (for example) 256MB in a wp-config file

    2 – The setting called “php_admin_value[memory_limit” which seems to be set at 32MB by default?

    Both are memory limit settings, but are they both the same? Or does one setting overide the other setting?

    Thanks for the help 🙂


Viewing 3 replies - 1 through 3 (of 3 total)
  • Faisal Ahammad


    The two settings you mentioned, WP_MEMORY_LIMIT and php_admin_value[memory_limit], both relate to the amount of memory allocated to PHP scripts on your WordPress site. However, they are set in different locations and have slightly different effects.

    WP_MEMORY_LIMIT is a setting that can be defined in the wp-config.php file of your WordPress site. This setting specifies the maximum amount of memory WordPress can allocate for PHP scripts. By default, WordPress sets this limit to 40MB, but you can increase it by adding the following line to your wp-config.php file:

    define(WP_MEMORY_LIMIT, 256M);

    This sets the memory limit to 256MB, which can help to prevent issues such as out-of-memory errors when running resource-intensive plugins or themes.

    The php_admin_value[memory_limit] setting is defined in the server configuration and sets the maximum amount of memory that a single PHP script can consume. This setting is typically defined in the server’s php.ini file or in the virtual host configuration file. By default, this setting is often set to 32MB.

    Which setting overrides the other?

    The WP_MEMORY_LIMIT setting overrides the php_admin_value[memory_limit] setting for WordPress scripts. This means that even if the php_admin_value[memory_limit] is set to a lower value, WordPress can still allocate up to the value set in WP_MEMORY_LIMIT.




    Try also adding this code to your wp-config to increase the memory limit for wp-admin (backend) actions:

    define(WP_MAX_MEMORY_LIMIT, 256M);

    Thread Starter Alwin


    Thank you very much Faisal, very clear for me now 🙂

Viewing 3 replies - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.