Support » Plugins » NextGen-Gallery Safe Mode stupidity

  • NextGen-Gallery plugin seem to unnecessary pay too much attention to Safe mode. And it does it WRONG! First of all, safe mode is NOT an obstacle if all is configured correctly. I.e. NextGen enforces user to chmod directories to 777 (safe mode is an excuse here), but this it absolutely silly if you are the owner of the directories here. Safe mode will NOT affect mkdir() nor any file operation here and chmod makes absolutely NO SENSE at all!

    Another example:

    The server setting Safe-Mode is on !
    Please create directory wp-content/gallery/test and the thumbnails directory wp-content/gallery/test/thumbs with permission 777 manually !

    Yes, it does use safe mode. So what?! did you try to mkdir() prior complaining? No. Does it work when hacked and removed all this silly checks. Like a charm.

    Conclusion: please fix your plugin to complain only when you got a real reason to do so.

Viewing 14 replies - 1 through 14 (of 14 total)
  • Quick hack for non-techies:

    edit admin/addgallery.php, and find line:

    225 // create new directories
    226 if (!SAFE_MODE) {
    227 if (!@mkdir ……


    231 } else {


    235 }

    (first columns is line numer). Now make NextGen don’t care safe mode by replacing

    226 if (!SAFE_MODE) {


    226 if (TRUE) {

    Simply add define(‘SAFE_MODE’, FALSE); after line 72 in nggallery.php to disable safe_mode check.

    Conclusion: Report bugs and fixes at the correct forum and inform the author…

    I probe two codes and i have and error create wp-contents/gallery/xxxx/thumbs

    the folder of gallery xxxx is created but folder thumbs no.

    My server is safe mode on.

    Please help.

    Note: Iยดm spanish and my english is little.

    Hi Alex,

    For now I use PicasaWeb for my galleries but I would like to integrate it with my blog. I looked around for all the gallery Plugins and yours seems to be the best out there.

    I have only one little problem. My server has PHP Safe Mode “On” and thus I can’t create any galleries with your Plugin. When I try to create the required folders manually they don’t show up in the adminstration.

    So I guess you gave the solution to tis with your reply before but I’m a little confused. Is this the place where I need to put the strip of code you gave earlier?

    // Version and path to check version
    define('NGGVERSION', "0.96");
    // Minimum required database version
    define('NGG_DBVERSION', "0.84");
    define('NGGURL', "");

    Thanks for your help and the great Plugin.

    i think the whole safe mode check reworked since that post, i tried to add the define('SAFE_MODE', FALSE); line after the following part, since that seems the last part, where something overrides my SAFE mode definition, without any success. :S

    // get value for safe mode
    if ((gettype(ini_get('safe_mode')) == 'string')) {
    	// if sever did in in a other way
    	if (ini_get('safe_mode') == 'off') define('SAFE_MODE', FALSE);
    	else define('SAFE_MODE', ini_get('safe_mode'));
    } else
    define('SAFE_MODE', ini_get('safe_mode'));


    I have the same problem and would like a solution!

    robmmad16 posted his exact error message over here. Same message shows up for me.

    Obviously there’s one easy solution…ask your webhost to turn of Safe-Mode if you don’t own your server and it should work.

    For all of us others, I hope Alex or someone else will come up with a solution for this.

    If you have a very resricted Safe mode, you must create all folder manually, there is no other way

    there is only one little problem with this manual-folder-creation, that the thumbnail creation is unsuccessful too ๐Ÿ™

    strange, ‘cos the file upload works for me

    Have you setup the permission correct ? I have one web hosting with safe-mode on and as long as I use the permission 777 it works for me

    It’s working for me now. I used to forget one thing. Once I created the folders manually they didn’t show up in the administration panel. But you have to create the gallery although you already created the folders manually. Then the gallery will show up and the upload will work like a charm as well as the whole Plugin. Hope you guys get it to work as well..good luck.

    The define(‘SAFE_MODE’, FALSE); trick just solves the creation of a new gallery when safe mode is on but that doesn’t help when creating the thumbs directory, so the trick is kind of worthless. Why doesn’t the trick work for both? I mean both are mkdir procedures…

    This seems like such a good gallery backend and just needs a few tweaks to work for people with safe mode on (which must be the majority of people on a hosted sever…?)

    No safe mode is not always used on hosted server, and it a bad solution at all… If you didn’t get it running I suggest to move to a other hoster or use the internal WP gallery system. NextGEN requires different folders and therefore it’s better to turn of the safe mode (if possible)…

    Ujjwal Agarwal


    hey alex…… i am desperately trying to get gennext gallery working for my photography website but..
    i could not create a gallery first … 50th time i tried it automatically got created …
    now it s not uplading images . .. says
    Error, the file could not moved to : /home/cam123/public_html/wordpress/wp-content/gallery/portraits/dsc_0378.jpg

    plz help ……. plzzzzzzzzzzzzzzzzzzzz

    Oh, guys, come on! Dont tell me you dont know how to create writeable directories when safe mode is on! I have done everything with safe mode on, it is not a problem, you just have to google a bit. The solution is to create dirs via FTP. Of course the problem is you have to provide the script your FTP username and password so it might be possibly greater risk than usin safe mode off ๐Ÿ˜€

    I would love to hear that authors of nextgen gallery added this option and let everyone choose his option how to get it work ๐Ÿ™‚

Viewing 14 replies - 1 through 14 (of 14 total)
  • The topic ‘NextGen-Gallery Safe Mode stupidity’ is closed to new replies.