While the Zenphoto has great support, I’ve found the upgrade instructions slightly lacking for my own needs. So I’ve written up detailed steps for upgrading Zenphoto, which should work with version 1.1.6 and onward. (Unless the backend of the upgrading process changes significantly in the future, of course.)
- Backup the entire Zenphoto site directory. Issuing a
cp -pr [zenphoto-dir] [zenphoto-backup]
would suffice. - Backup the MySQL database. I use phpMyAdmin for this, so here are the steps for that tool:
- Select your Zenphoto database, then click the Export tab.
- Under the Export section, make sure all the tables are selected.
- Under the SQL Options > Structure section, make sure the checkboxes for only Structure, Add DROP TABLE / DROP VIEW, Add AUTO_INCREMENT value, and Enclose table and field names with backquotes are selected.
- Select the checkbox for SQL Options > Data, but don’t select any of the sub-choices.
- Btw, all the remaining SQL Options should be deselected (unchecked).
- Select the Save as file checkbox, otherwise nothing will get backed up. Feel free to chose any of the compression choices, but I typically only use None.
- Hit the Go button. A backup
[db_name].sql
file should happily appear in your computer’s download location (e.g., the desktop).
- Make sure you have a copy of the
.htaccess
androbots.txt
(just in case) and your previouszp-core/zp-config.php
files. You’ll needzp-config.php
for step 6. - Get the latest version of Zenphoto, but don’t upload it yet!
- Unzip the new Zenphoto package and if you are upgrading, remove its albums folder. Otherwise, copying it over will clobber your existing albums and photos!
- You’ll need to edit the new version of the configuration file with your database information. Update: Actually, as of v1.2.x, you don’t need to manually edit
zp-config.php
; the installer will do it for you. However, do make a note of the settings since the installer will prompt you for them! Looking at the old copy, change the following inzp-core/zp-config.php
with your own specific settings:$conf['mysql_user'] = "your-mysql-username";
$conf['mysql_pass'] = "your-mysql-passwd";
$conf['mysql_host'] = "your-mysql-host-URL";
$conf['mysql_database'] = "your-zenphoto-db-name";
$conf['mysql_prefix'] = "your-zenphoto-db-prefix";
(If it has no prefix, just use the empty string""
)
- Now you can upload the new Zenphoto files, overwriting the appropriate old ones.
- To start the upgrade process, load the URL for
your.zenphoto.site
. But if it doesn’t start properly, just loadyour.zenphoto.site/zenphoto/zp-core/setup.php
, which is where it’d redirect to anyhow. - At some point you’ll be prompted to login as the administrator, after which you should get the Go! button. Select your language from the dropdown menu, such as English (US), then hit Go!
- When you get the following message, it means that everything succeeded.
About to update tables…
Done with table update!You can now View your gallery, or administrate.
Troubleshooting
I get a 403: Forbidden error when I try to just load my Zenphoto site. The .htaccess
needs to be readable by everyone in order to view, administrate or upgrade your Zenphoto site. Issuing chmod 644 .htaccess
should do the trick. On a side note, I change the permissions for albums
and cache
directories from 777 to 755, because my hosting service runs the appropriate server processes as me, rather than another administrative user. Likewise, I change the uploaded images to 644, rather than 666.
I got as far as step 8 to run the upgrade script, but I get a blank page. Make sure you have edited zp-core/cp-config.php
with your specific database settings (step 6) before you run the automatic upgrade.
I don’t get a login prompt, or the Go! button never appears at step 9 for me. Or, I get weird errors during the “About to update tables…” part of the upgrade. Try reloading your.zenphoto.site/zenphoto/zp-core/setup.php
. Strangely, that seems to give it push in the right direction.
I get the page with Go!, but I also get an error that I need to upload the .htaccess
which came with the new version. But I don’t want to clobber my special changes! You backed it up, right? (Step 3.) In which case, just upload the newer version per the Zenphoto instructions. After you have finished the upgrade, you can go back and edit .htaccess
to further modify it.
Oh noes! Where did my robots.txt
file go? Ah, you might’ve copied over the new Zenphoto directory to clobber the entire old one. What I do is select the contents of the new one and copy them over into the old one, so that files missing in the new package still persist. But restoring robots.txt
is a snap if you already backed it up at step 3.
Extra. I want more control over hotlinking. How do I prevent everyone but allow a select few? For example, to allow access from your own domain, Google and cached searches, paste the following between the RewriteBase /
and RewriteRule ^admin/?$ zp-core/admin.php [R,L]
statements in the IfModule mod_rewrite.c
section of the .htaccess
file:
RewriteCond %{HTTP_REFERER} !mydomain\.com [NC]
RewriteCond %{HTTP_REFERER} !google\. [NC]
RewriteCond %{HTTP_REFERER} !search\?q=cache [NC]
RewriteCond %{HTTP_REFERER} !^$
Don’t forget to use your own domain name. This works when Full image protection uses Protected view with Disable hotlinking selected (located under Options > Image Display of the Zenphoto admin tools). Update (16 Sept 2009): I no longer seem to need to do this task as of version 1.2.6.