Support » Fixing WordPress » WP_MEMORY_LIMIT has no effect / PHP has memory

  • Resolved Sinaca


    I am running on a dedicated host that I have configured to allow 256M of memory for PHP. I have confirmed this change by running phpinfo() in the root directory of my WP installation.

    I have added the following line to my wp-config.php:

    define( ‘WP_MEMORY_LIMIT’, ‘128M’ );

    I am using Server IP & Memory Usage Display and it shows this:

    Memory: 55.08 of 256 MB (22%) | WP LIMIT: 128 MB

    I can change WP_MEMORY_LIMIT in wp-config.php and the new number is reflected in the above status line but appears to have no impact on the actual available memory (which appears to be 64 MB).

    I can even set WP_MEMORY_LIMIT to a ridiculously low number and nothing appears to actually change other than the value reported by the memory display:

    Memory: 55.09 of 256 MB (22%) | WP LIMIT: 4 MB

    I have also checked for stray .htaccess and php.ini files but there are none.

    I’ve been at this for days – any help would be greatly appreciated.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Sinaca


    I believe I solved this. Documenting here in case someone else has the same problem.

    Adding a php.ini file with the following to the /wp-admin folder appears to have worked:


    Moderator James Huff


    Volunteer Moderator

    Yes, to clarify, define( 'WP_MEMORY_LIMIT' simply limits how much memory WordPress can use from PHP’s allocated memory. It limits its memory usage, rather than expanding it.

    Without that line, WordPress will use as much of the memory allocated to PHP as it can.

    So, boosting PHP’s memory allocation in php.ini was the right thing to do, and I also recommend removing the define( 'WP_MEMORY_LIMIT' line if you haven’t already. 🙂

    Actually, Don’t remove the define() … you need to add the define AND update the PHP settings.

    WP defaults to lowering the memory limit 40M unless WP_MEMORY_LIMIT is defined. See:

    Is there a limit to add within the WP_MEMORY_LIMIT ?

    Also within the php.ini file I notice it states the following:

    “Maximum amount of memory a script may consume (128MB)”

    So, can I increase the 128mb to say 2gb?

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘WP_MEMORY_LIMIT has no effect / PHP has memory’ is closed to new replies.