(Preface: Gallery is an open source tool for hosting photos on your website.)
So, suppose you upgrade your copy of Gallery to the latest version (1.4.4-pl4 as of this writing), you follow the upgrade instructions, re-run the configuration wizard and then you get a goofy error such as this:
Warning: fopen(/home/abischof/httpdocs/albums/2003/photos.dat.lock): failed to open stream: Permission denied in /home/abischof/httpdocs/gallery/platform/fs_unix.php on line 55
Error: Could not open lock file (/home/abischof/httpdocs/albums/2003/photos.dat.lock)!
Yeah, that happened to me. Fortunately, there’s a known workaround. As it turns out, it’s not Gallery’s fault if this occurs — it generally only happens if your web host mucks up your permissions while upgrading your PHP setup. The solution? Just set the permissions on every file in your “albums” directory to 777.
As noted in the workaround, this is fairly straightforward if you have shell access to your web host (just run “chmod -R 777 albums” from the parent directory). But, if you only have ftp access, then you’ll need to set each set “albums” to 777 manually; and, if your ftp client can’t recurse through directories, then you’ll need to manually hop through each directory within “albums” and manually set every file to 777. That should do it :).
That worked great. One thing I do besides this for my ./albums directories is to add a file named ‘index.html’ in each of the gallery album directories to keep folks from being able to view the bare directory. In fact, you can even put an HTML redirect to bring stray browsers back to the gallery main page.
If your web host allows, add this to your .htaccess file to accomplish the same thing but without all the work.
Options -Indexes
This also can happen if the owner of the album directory is not set to nobody or www which are expected by Apache.
Thanks for the 777 tip, works like a charm.