WordPress.org

Support

Support » How-To and Troubleshooting » ALERT – script tried to increase memory_limit to 268435456 bytes which is above

ALERT – script tried to increase memory_limit to 268435456 bytes which is above

  • Ryan Cowles
    Member

    @metacomcreative

    I have been experiencing significant lag and timeouts in the backend of one of my WordPress installs. I enabled error logs and am now seeing errors that keep showing line 109 in ../wp-admin/admin.php Here are two examples chosen at random:

    [Tue Apr 24 13:14:46 2012] [error] [client xx.xxx.xxx.xx] ALERT - script tried to increase memory_limit to 268435456 bytes which is above the allowed value (attacker 'xx.xxx.xxx.xx', file 'path/to/file/wp-admin/admin.php', line 109), referer: http://www.DOMAIN.com/wp-admin/post.php?post=2276&action=edit
    [Tue Apr 24 13:24:10 2012] [error] [client xx.xxx.xxx.xx] ALERT - script tried to increase memory_limit to 268435456 bytes which is above the allowed value (attacker 'xx.xxx.xxx.xx', file 'path/to/file/wp-admin/admin.php', line 109), referer: http://www.DOMAIN.com/wp-admin/options-general.php

    What could be causing these errors? And how can they be fixed?

Viewing 15 replies - 1 through 15 (of 25 total)
  • esmi
    Forum Moderator

    @esmi

    Try increasing the memory available to PHP. Or switching themes and deactivating some plugins.

    Ryan Cowles
    Member

    @metacomcreative

    Thank you! I will try increasing the memory limit, but I would ideally like to identify what exactly the errors are stemming from.

    esmi
    Forum Moderator

    @esmi

    From your theme and your plugins.

    I had the same problem, and even if I HAVE access to my apache+php configuration, I REFUSE to give to a php process 256 M of memory limit.

    Neither I want to change admin.php file because it will be overwritten every time I upgrade WordPress.

    Don’t you guys think 256 it’s too much ?

    Please go back to 128 in next versions, a php CMS should work with 32M of memory.

    Jan Dembowski
    Volunteer Mod. & Brute Squad

    @jdembowski

    Yes, and it does too. See the part about

    From your theme and your plugins.

    Just a plain installation of WordPress doesn’t take up 128MB of RAM. But tack on memory hungry code from a theme and/or plugins? Those take lots of RAM and some add-ons are not well written memory use wise.

    If you can’t allocate the additional RAM then use a different theme and plugins.

    But why we are talking about ../wp-admin/admin.php ?

    That memory allocation is not inside bad plugins / themes …
    … or am I wrong ?

    Jan Dembowski
    Volunteer Mod. & Brute Squad

    @jdembowski

    You’re wrong, but that’s OK. 😉

    The stock plain single-site WordPress running with the Twenty Eleven theme and no plugins doesn’t use 128MB of RAM. I’m reasonably sure that 32MB is fine for that setup.

    But when you add plugins, themes, multisite, etc. then your memory requirements can increase too.

    I’m running multi-site with themes and plugins. On my primary site I’m running 16 active plugins.

    I set my memory_limit = 80M but I really don’t need to above 64M (remember, I’m running multisite). I had a plugin which was eating all of my RAM but that’s gone and I haven’t had memory limit issues in months.

    My (rambling) point is: if you need more RAM allocate it. If you can’t then start making decisions about the add-ons that you are using.

    Yes but my point is different, as a webmaster but also hosting provider, I don’t want a CMS to have in it’s code a function that, ON REQUEST, asks for 256 M of RAM.

    I don’t care about how much themes and plugins my customers have activated, their websites have to FAIL to open and gives error if they go over my memory_limit in php.ini.
    This is why a memory_limit exists.

    So I’m asking you and WP developers to find a more flexible way to fix things, that could be a new option in wp-config like:
    define(‘WP_MEMORY_LIMIT’, X);

    Where X is the maximum memory limit that WordPress will ask for a user that activate 2305982 plugins without caring about my server.

    p.s. this line 109 in admin.php can be the cause of MANY of my server crashes in this last months.

    Jan Dembowski
    Volunteer Mod. & Brute Squad

    @jdembowski

    So I’m asking you and WP developers to find a more flexible way to fix things, that could be a new option in wp-config like:
    define(‘WP_MEMORY_LIMIT’, X);

    I’m not a developer (good thing too) and I’m sure you know that that option is already available.

    http://codex.wordpress.org/Editing_wp-config.php#Increasing_memory_allocated_to_PHP

    p.s. this line 109 in admin.php can be the cause of MANY of my server crashes in this last months.

    Not sure what to say about that, that shouldn’t cause any host to crash.

    An occasional warning in log file is just background noise. If it’s filling up the disk space then you have an option to increase your memory limit or not use WordPress.

    WordPress may have different requirements but at the end of the day it’s just another collection of PHP scripts.

    Ok, so the answer to give to the first poster was this:
    define('WP_MEMORY_LIMIT', '128M');

    And now it’s a resolved topic.

    RavanH
    Participant

    @ravanh

    Hmmm… Running into this issue on a fresh WordPress 3.4.1 install that I’ve just converted to a Multi-site setup. Nothing installed other than bare WordPress so it does not seem to be related to ‘themes or plugins’. And setting WP_MEMORY_LIMIT in wp-config.php to within the (in my opinion reasonable) 64M limit on the server, does not fix the issue.

    Why would WordPress even be ask for such a high memory limit??? I’m pretty sure it only needs about 40M at the most. And running APC on the server, it is usually half that number.

    jruberto
    Member

    @jruberto

    The OP’s error / alert is from Suhosin. Suhosin “protects” PHP with a very restrictive set of rules.

    Certain plugins might need more memory (i.e. image processing scripts), and therefore attempt to increase the memory available — and Suhosin doesn’t permit that.

    When Suhosin disallows something it just silently fails, it doesn’t cause a runtime PHP error, and it only logs to syslog. Usually the symptom is you try to do something, it looks like it worked, and then you reload the page and it didn’t work.

    Yes, the proposed solutions (changing PHP’s memory limit on-the-fly) would CAUSE this error on a Suhosin-protected server.

    Anyway, philosphical arguments aside, the fix is to make sure suhosin is configured for:
    suhosin.memory_limit = 256M

    RavanH
    Participant

    @ravanh

    Thanks jruberto, that did indeed solve the issue without increasing the PHP memory_limit to 256M in php.ini

    And thanks for the clear explanation on Suhosin 🙂

    One interesting question remains: why and when would the WP admin need 256M? It certainly is not needed for normal operations. Maybe on a multi-site install when upgrading or something? And why not only try to increase the memory_limit at such a point instead of doing that all the time?

    Jerry_S
    Member

    @jerry_s

    Actually WP_MEMORY_LIMIT is the wrong parameter (it defaults to 32M/64M for single/multiple sites). The one you want is WP_MAX_MEMORY_LIMIT, which defaults to 256M.

    Thank you for the great fix.

Viewing 15 replies - 1 through 15 (of 25 total)
  • The topic ‘ALERT – script tried to increase memory_limit to 268435456 bytes which is above’ is closed to new replies.