Support » Fixing WordPress » [Plugin: NextGEN Gallery] Exceed Memory Limit – I’ve Done Everything

  • I’m running NextGen-Gallery (.96) on WordPress MU 1.5.1 (WP 2.5.1 core). My relevant php.ini settings are as follows:
    upload_max_filesize = 50M
    memory_limit = 64M
    post_max_size = 50M

    When I attempt to upload an image that is 169KB the image uploads and the thumbnail is created as expected.
    When I attempt to upload an image that is 1.32MB I get the following error : “img_3877.jpg (Error : Exceed Memory limit. Require : 35.38 MByte)” & no thumbnail is created.

    When I attempt to ‘create new thumbnails’ within the Gallery itself I get the same error.

    I also ran the 1&1 memory script and passed all the tests.

    What the heck? How in the world is 35.38 MBytes needed to create a thumbnail for a 1.32MB image? And even if it does, what setting is not right in my php.ini file?

    I’ve read every related post I can find. Can’t see what I’m missing. I’m stumped.

Viewing 15 replies - 1 through 15 (of 20 total)
  • Did you ask your web host to up your php memory limit to something like 48MB? Sometimes just futzing with the .htaccess or php.ini file doesn’t do the trick.

    What the heck? How in the world is 35.38 MBytes needed to create a thumbnail for a 1.32MB image?

    Thanks for the help. I understand the memory limit issue related to thumbnails now thanks to the link. Thanks, Alex! Unfortunately I’m still having the same issue. My web host has confirmed that php.ini sets my memory limit. It is set to 64MB as noted in my original post. They don’t otherwise restrict the memory limit.

    It is curious to me that when I attempt to upload an image via: ‘Gallery > Add Gallery > Upload Images’ there is a note under the ‘Choose Gallery’ pull-down menu that says ‘Note : The upload limit on your server is 2MByte ‘.

    Also after attempting to upload an image of 1.32 MB (2272×1704) the image uploads successfully, but the thumbnail fails to create and gives the following error: img_3877.jpg (Error : Exceed Memory limit. Require : 35.2 MByte).

    I’m also wondering if the php.ini script needs to be in a directory other than my web root?

    Any more help would be much appreciated.

    From what I understand, the php.ini fine is not recursive; it needs to be in each directory where the problematic script resides.

    I know for my case, with Alex’s (wonderful!!!!) Next Gen Gallery, I was having problems with thumbnail creation until I asked my web host to up my memory limits. 🙂

    Joni, thanks for the input. My web host insists that they do not control my memory limits. The only way to lower or raise the limit is via the php.ini which I have complete control over.

    As far as placement of the php.ini file, sounds like you literally copied it to every directory associated with Nextgen-Gallery. I wonder about a better approach. Someone suggested you could create a symbolic link to the file via .htaccess. This would allow an easy undo of this change if necessary. It would also take care of added directories in the future. I’m not very good at modifying the .htaccess file. If someone knows how to do what I’m talking about I’d appreciate any help.

    Does NGG shows under server settings a memory limit of 32 MB or 64 MB ?

    Alex, where do I find the ‘server settings’ you mention?

    Ok I see you have WPMU (there it’s hidden), so you need read the memory_limit with phpinfo()

    This gets interesting. phpinfo() returns different results depending on which directory it is in:

    * if my updated php.ini is in the same directory as phpinfo.php then phpinfo.php returns the modified settings (memory_limit=64MB & upload_max_filesize=50MB)

    * if my updated php.ini is NOT in the same directory as phpinfo.php then phpinfo.php returns the default settings (memory_limit=32MB & upload_max_filesize=2MB)

    The question is – Where does php.ini need to be located for NGG to work with the modified settings?

    Well, I took a bit of a brute force approach. I copied the php.ini file to the root directory for my WP install and to every sub-directory under it. That fixed the issue.

    I hope it doesn’t cause me trouble in the future. For others who need to take a similar approach I used this script to do the work of copying the php.ini to all the sub-directories:

    system(“find * -type d|xargs -i cp –verbose php.ini {}/.”);

    Here’s what you do:

    1. Create a new file called ‘copyphpini.php’ in your WP root.
    2. Paste the code above in the file & save.
    3. Use a web browser to go to:
    4. The locations to which the file is copied will output in the browser window

    I cannot guarantee that the additional instances of your php.ini file will not muck up things for you. Undoing could be as easy as modifying the script to remove instead of copy, but I haven’t tried.

    After much trial and error (mostly error), I think I figured out that the file goes into the /wp-admin/ folder. More explanation here.

    i am in the same situation, i have really done everything but i still get the same error.
    in order i have:
    – edited an .htaccess file
    – edited a php.ini file
    – ran into the test here (you can see the results here which says that it works)

    every single time i try to upload a picture, no matter how little it is i get:
    Error : Exceed Memory limit. Require : 42.78 MByte)

    what can i do?
    the information on nextgen-gallery says
    Memory usage : 40.91 MByte
    # PHP Max Upload Size : 32M
    # PHP Max Post Size : 32M

    i have also disabled all the plugins that i did not need!
    any help is much appreciated!


    ok, after searching and searching i solved it!
    just add this line
    `ini_set(“memory_limit”, “48M”);

    at the top of

    it just works!

    Is it me

    or can’t this be right `ini_set(“memory_limit”, “48M”);

    ‘this given unexpected error

    What should this be. I still have the problem

    It’s even easier. Find this document:

    search for
    // @ini_set(‘memory_limit’, ‘128M’);

    change it to
    ini_set(‘memory_limit’, ‘128M’);

    save. upload. ready!

Viewing 15 replies - 1 through 15 (of 20 total)
  • The topic ‘[Plugin: NextGEN Gallery] Exceed Memory Limit – I’ve Done Everything’ is closed to new replies.