NextGen Gallery: upload_max_filesize

The fabulous NextGen Gallery was maxing (timing) out when uploading zip files. My server said it could only handle 2 MB uploads, so I went searching.

Most help said to make changes to the .htaccess file, but I did that and I think my host has something set up (suexec or something) that doesn’t allow such code in there, so it said to create a php.ini file with the following code:

  1. post_max_size = 50M
  2. upload_max_filesize = 40M
  3. max_execution_time = 900
  4. memory_limit = 30M

Did that and put it in the root directory with no luck. Someone else said to put it in the directory where the script was, so I put it in the NextGen Gallery folder. Nope. Put it in ALL of the NG folders. Nope. Finally, seeing the WP plugin in action, I put the php.ini file in the /wp-admin/ folder and voila!

Also, when making the php.ini file, I used the code above, not the one with “php” in the directives. Those were for the .htaccess file.


About the Author:

I've done the big corporate thing. I've done the creative writer thing. Now I'm happily in the middle. I like to help small businesses who are interested in "working their website before their website works them." I'm also interested in creating beautiful sites with powerful WordPress themes. Google+


  1. Jim July 26, 2008 at 6:52 pm - Reply

    Very accurate post!!! Thanks so much.

    I had to increase memory_limit above 30M so a thumbnail could get created for a 3.5mb picture. I set it to 100M just cuz I did not want to spend time tweaking exactly.

    Thanks again!

  2. Jim July 26, 2008 at 6:53 pm - Reply

    We also have to remember to watch this php.ini file during an upgrade.

  3. webweaver August 4, 2008 at 12:00 am - Reply

    I’m having the exact same problem, and have probably trawled my way through all the same places as you have to find the answer.

    I found an alternative solution here – see staceppa’s comment at the end of the thread – which works for most of my files but not the very largest ones, even if I increase the value from 48M to 100M.

    So I figure now it’s time to try your solution. I need a bit of help though.

    What do I use to make the php.ini file? Is Dreamweaver OK? What format should it save itself as? Mine has saved as a plain text document. Is this OK?

    Do I need the numbers from your code above, or do I leave those out?

    If I add the file to the /wp-admin/ folder as you suggest, am I likely to be overwriting the original php.ini file (which isn’t listed as a file there but which I’m worried might be hidden or something.)

    Thanks heaps


  4. MeiaLua August 4, 2008 at 9:34 am - Reply

    Splendid, this worked liek a charm for my zipped jpg archive! Thxs!

  5. pr'muts September 3, 2008 at 5:16 pm - Reply

    i’m having the same problems as webweaver and they aren’t solved by either two solutions ( – and this one).

    Just to be sure: do I have to add [PHP] as first line in the php.ini?

    And… when uploading a pic ngallery says “Note : The upload limit on your server is 8MByte”. Then the actual pic is saved but the thumbnail isn’t.

    So help!

  6. Bradley Charbonneau September 9, 2008 at 10:59 pm - Reply

    webweaver: I just used Notepad (on WIN) to make the php.ini file. You don’t want to use something like Word that will put extra code in there. But then it does seem to save it as a .txt file. I don’t really know how to change that other than using a simple file folder system and I changed the .txt to .ini (I used FileZilla as it shows files with their real extensions and you can just change them).

    Leave the numbers out, I think they’re just for show here on this site.

    I didn’t see a php.ini file in the wp-admin folder, but if there is one, maybe rename it something else (php_original.ini) and then upload your php.ini file. But I don’t think I had a php.ini file in that folder.

    I hope that helps!

  7. Bradley Charbonneau September 9, 2008 at 10:59 pm - Reply

    pr’muts: No, I don’t think you have to add [PHP] in the php.ini file, just the text up there in the code (without the line numbers).

  8. Bradley Charbonneau September 9, 2008 at 11:01 pm - Reply

    Jim: You’re absolutely right and I’m sure it’s something I’d forget and then wonder why the limits were back to where they were! Always good to backup, of course. I’ve been using WP’s new automated upgrade plugin quite a bit and loving it. I wonder if it deletes all folders (well, the wp-admin etc. folders) and the uploads the new versions or if it keeps files it doesn’t recognize. I guess we’ll find out …

    Thanks for posting, Jim.

  9. Ante Logarusic September 30, 2008 at 7:45 am - Reply

    Thanks a million for this you guys. I’ve been tearing my hair out trying to fix this glitch for my clients.

  10. Laura Schatzkin October 14, 2008 at 9:15 pm - Reply

    Thanks, pal, for doing the research for me and saving me hours of aggravation — hours I just don’t have right now. You’re the best.

  11. Mike Masi October 30, 2008 at 4:09 pm - Reply

    Perfect! Thanks!

  12. Kurotsuki November 6, 2008 at 11:27 am - Reply

    THANK YOU SOOOOO MUCH ! I have been looking for a solution to this problem for more than 3 months and now, thanks to you, I finally succeeded ! You’re my hero ! xD

  13. Tony Zeoli November 8, 2008 at 6:03 pm - Reply

    Just found this solution after looking for months. I guess you’re rising in the Google search rankings. This definitely worked for me without having to do anything else. I added the parameters to the php.ini file, dumped it into wp-admin and it worked like a charm. Thanks! Someone should now write this as a plug-in.

  14. Irina November 28, 2008 at 5:23 am - Reply

    Awesome! Creating this php.ini file really did the trick for me! Thank you for sharing.

    I guess it’s not always about the upload size (mine was 64MB preset, so shouldn’t have been a problem here), maybe it’s the time out thingy that’s causing problems with the zip upload.

    Anyway, it’s working perfectly now!

    (Leave the numbers out in the code, they don’t belong in the ini-file. Also the file must be named php.INI, not .txt or .doc or anything, you can change file extensions in your FTP program or setup your Windows Explorer to show file extensions, just google it if you don’t know how to activate this feature).

    Good luck to everyone out there having the same problem! :)

  15. Rafael December 1, 2008 at 5:56 pm - Reply

    I’m still having the same problem and nothing seems to work. I fixed the download limit, but the memory limit still an issue and I do not know what to do to fix it. I tried everything here.

  16. BirminghamIU December 7, 2008 at 5:29 am - Reply

    I am attempting this fix now it’s 12:30 in the afternoon (British UK time) and i have been up since 6:00pm last night trying to fix this problem. I hope this works. I’ll keep you posted. Thanks!

  17. BirminghamIU December 7, 2008 at 5:32 am - Reply

    Been going for five minutes now longer than usual so who knows it might work fingewrs crossed X

  18. BirminghamIU December 7, 2008 at 5:40 am - Reply

    I think this has fixed my problem it appears to work perfect. Thank you.

  19. Lori Burgard December 14, 2008 at 11:48 am - Reply

    THANK YOU!! I’ve searched for hours and kept trying different directories as well.

  20. LordCrap February 6, 2009 at 2:18 pm - Reply

    Sweet, thanks a lot, I’ve been pulling hair over this for some time now!

  21. rhoen February 6, 2009 at 6:25 pm - Reply

    perfect tutorial! thanks a zillion!

  22. chris March 12, 2009 at 9:42 pm - Reply

    hello! so this was great to find– and i made the /ini file and uploaded it — and the uploader appeared to be working until the very end — when it gives an “HTTP error” any ideas?

  23. florence professional firefighters April 25, 2009 at 8:03 am - Reply

    thank you!

    i have been messing around with trying to get this plugin to work right for a couple of months now, and this simple “fix” and easy to understand directions has finally fixed my problems!

    Now my thumbnails are working and I’m not getting those crazy memory errors any more!

    Thank you again!

  24. […] NextGen Gallery upload max filesize Likoma Posted by root 5 minutes ago ( Hot flashes sexy stories 96186 views using google apps email for i found an alternative solution here http wordpress org support topic 179176 see staceppa comment at the end time and i have been up since 6 00pm last night trying to fix this problem copyri Discuss  |  Bury |  News | NextGen Gallery upload max filesize Likoma […]

  25. costume jewelry June 15, 2009 at 4:16 am - Reply

    Fantastic post, I am a big fan of NextGen Gallery, so I am very happy to read this post. I found your blog a few days ago on Technorati and have been reading it over the past few days.

  26. Antalya Evden Eve Nakliyat June 17, 2009 at 8:50 pm - Reply

    THANK YOU!! I’ve searched for hours and kept trying different directories as

  27. John June 29, 2009 at 6:40 pm - Reply

    THANK YOU. I’ve also been searching for quite some time between different sites. This is the only solution that has worked.

  28. […] NextGen Gallery: upload_max_filesize […]

  29. Dan September 5, 2009 at 5:30 am - Reply

    Finally a solution to this plugin, thanks a bunch Bradley, this really did the trick.

  30. Mike September 7, 2009 at 2:38 pm - Reply

    Thanks, not sure if I would of figured this one out w/o ya.

  31. discount electronics September 12, 2009 at 9:28 pm - Reply

    Very usefull tips for “upload file” in PHP. Thanks!

  32. […] Read this article: NextGen Gallery: upload_max_filesize | Likoma […]

  33. aaa November 22, 2009 at 7:55 am - Reply

    doesnt work for me :/

  34. DavidM November 29, 2009 at 8:52 pm - Reply

    Thanks much for this one. I read through so many articles trying to resolve this. No one mentioned to put the php.ini file in wp-admin. Good troubleshooting.

  35. John November 30, 2009 at 8:43 am - Reply

    I did exactly as the tutorial said. Created a php.ini, put the code in (without the numbers 1,2,3,4) saved & uploaded to wp-admin and it still doesn’t work for me.

  36. gelo December 14, 2009 at 4:24 am - Reply

    Thanks, this works also for problems uploading images bigger than 2MB.

  37. Ian February 25, 2010 at 5:13 pm - Reply

    Thanks so much for the tip; I had my .ini file in all the logical places. Who would have thought the plugin was set to read the one in the wp-admin folder. Thanks for your post!

  38. […] Billeder, Brugervenlighed, Filstørrelser, PHP, php.ini, […]

  39. impulse October 15, 2010 at 12:27 pm - Reply

    Thanks! that worked for me, no more strange errors about memory. I am hosted at strato.

  40. eserve February 2, 2011 at 5:58 pm - Reply

    Thanks! You saved me hours.

  41. Ben April 23, 2011 at 10:09 am - Reply

    Thanks! I ran into this, and I know this is old, but it worked perfectly. Saved me a ton of headaches

  42. affordable legal fees April 28, 2011 at 10:11 pm - Reply

    Thanks, found your post after tying everything under the sun. Just dropped php.ini in wp admin folder and now everything works perfect, wish i would have found this post sooner…

  43. Pam June 8, 2011 at 6:50 pm - Reply

    Hello Bradley,
    Thanks for sharing this. It would really helps.
    Pam recently posted … Bay Window Curtain Rods

  44. Mel June 29, 2011 at 2:34 am - Reply


    this worked for me:

    Edit nextgen-gallery/lib/

    Find the line that says:
    // @ini_set(‘memory_limit’, ‘128M’);

    Remove the // to uncomment the line.

    Beneath that add:

    @ini_set(‘post_max_size’, ‘128M’);
    @ini_set(‘upload_max_filesize’, ‘128M’);

    You would just need to watch out for this when you upgrade the plugin.

    Cheers :)

  45. nik August 25, 2011 at 9:19 am - Reply

    hi !

    using nextgen public uploader i experience the following:

    after successfully uploading a photo the browser refreshes the page but the pic isn’t displayed.
    when manually reloading the pic gets uploaded again and after that the first upload can be seen . . .

    any ideas to this ?

    every browser and wpms

    thanks :)

  46. luis August 22, 2012 at 8:18 am - Reply

    Thank you! I tried everything but only that solution worked for me. Thank you so much.
    luis recently posted … Milton de Oliveira

  47. Ashish March 24, 2013 at 12:11 am - Reply

    I want to code one PHP script which allows me to generate thumbs of given images with specified dimensions and names as per Next-Gen Gallery Plugin of WordPress.

    I have website for cover pages:

    Thumb Gallery Page:

    Main Image Page:

    Issue is timeout when I upload images in wordpress plugin. It uploads images in create their thumbs but when I upload more than 10 images it fails. So I want to separately create PHP script which create thumbnails of my FB cover pages with given dimensions and specified name (a pattern).
    Many of the images are in .jpg, .png formats but all are having dimensions of 851×315.
    Any help would be appreciated.

  48. Do September 30, 2013 at 5:46 am - Reply

    Very good! Really this is a different plugin for WP. Its structure in HTML and JS is well organized and helps us a lot with a great interface! Thank you!

Leave A Comment

CommentLuv badge


Pin It on Pinterest

Share This