Gallery2:Preinstaller Problems - Gallery Codex
Personal tools

Gallery2:Preinstaller Problems

From Gallery Codex

Upgrading a Gallery2 installation that has been installed with the Pre-Installer

If you are reading this before installing Gallery2, my advice would be NOT to use the Preinstaller. Just upload the files using an FTP program, and all will be well. However, my guess is that you are reading this after using the Preinstaller, are starting to panic, and have done a search for Help, just like I did. Here are some tips to help you. The answers ARE on the Gallery2 site, but they are not easy to find.

The Preinstaller is very good, and works well - there is no question about that. It makes uploading files very easy - no more worrying about FTP drop-outs, and wondering which files have been uploaded and which lost. But there's a sting in the tail. The problem comes from the fact that after it has done its job, all the files and folders that it used or installed, including the main Gallery2 folder, are now 'owned' by the System, not by you. This means that after your successful installation, when the Preinstaller recommends that you change the permissions (also called 'CHMOD') of the Gallery2 folder from 777 to 755, and you log in with your favourite FTP program or web interface (Cpanel, Vdeck etc) you will find that you get a message saying "/public_html/gallery2 chmod failed: Operation not permitted".

Oh my God - I can't access my own files?! A search of the Gallery 2 documents eventually located a page about the Gallery2:Preinstaller which tells me that I already have a tool on my site to help with this, at But when you access it, you will be asked for your site password, so make sure that you have it handy. This password is not the one that you entered into the '$passPhrase = "";' line of the preinstall.php. It is not the line of text contained in the 'login.txt' file that you had to upload during the installation. If you lose your password, or forget it, or try the wrong one, the CHMOD Tool Page will then tell you 'Failed login attempts: 1 out of a total of 7', and so on, as in your panic, you keep trying to remember what you had originally entered. I have no idea what happens if you get to 7: maybe you will be locked out for good?? Best not to go there!

The CHMOD Tool Page trys to be helpful by telling you that your password can be found in your gallery/config.php file like this: $gallery->setConfig('setup.password', 'your password here'); BUT if the system is locked down as mine was, when you point your FTP program there, you will find that its permissions are set to 640, which means you can't view the file. It comes as no surprise to discover that you aren't allowed to change them either! Luckily, there is still one final option open - you must visit this page: Bharat's Cleanup Script. Unzip the file, and upload 'cleanup.php' to the same directory as your gallery2 folder i.e. if your folder is at www.mysite/gallery2 then you should upload the file to www.mysite/cleanup.php Point your browser at that page, and enter the path to your gallery2 folder i.e. /home/~you/public_html/gallery2 Press 'Go' and if you have the path set correctly, all the permissions will be opened up. You can then browse to your config.php file, and find out what your password is, which lets you access the Gallery Support. Use that to start the CHMOD Tool Page, and you will then be able to lock your Gallery down again, by making everything read-only. If you get Errors, use the Cache Maintenance Page, also from Gallery Support.

The Gallery will now work OK, even though you can't access it with an FTP program. Does this matter, I hear you ask? Well, no, I suppose it doesn't really matter. Those of us 'old-timers' from the days of 486's and 10MB hard drives will feel a little nervous that there are files on our servers that we can't access readily, but as long as the Gallery2 program works properly and doesn't introduce any security implications, then heck why not leave it alone?! The Gallery2:Preinstaller page does tell you how to upgrade a Gallery2 installation that has been installed with the Pre-Installer, so I guess its alright.

Deleting unwanted albums can be a bit of a nuisance, though, and it was that that prompted me to rip it out and start again. I was glad I did, before my Galleries got too complex. If your Gallery2 installation has only a few photos in it, I would suggest deleting it altogether too, then reinstalling by uploading the files with a standard FTP program. (I'm a big fan of SmartFTP, which is not only very capable, but is free for personal use.) It may take a couple of hours to get your Gallery2 installation back to where it was, but it will save you much more time than that in the long run, as well as a lot of hair-pulling.

Please note that all of the above is a personal opinion from a happy Gallery2 user: it does not come from the Design Team.