Buy One Domain Name, Get One Free

Looking for a reliable and affordable Domain Name Registrar? Look no further than Dotster. And for a limited time, we're able to offer our visitors a buy one domain name, get one free promotion. Click here to take advantage of this offer.

Save $50 on Dreamhost Hosting - Any Plan

As a preferred visitor, you can get $50 off of any Dreamhost hosting plan by using coupon code CWD50 when you check out, for a limited time. Dreamhost is a reliable hosting provider with solid customer service and a proven track record.



Feb 27 2007

Moving Your Gallery2 Installation From One Site To Another


Filed under: Content Management Systems » Drupal,
Tools:

How to move your gallery2 installation from one site to another

The basic premise here is that you are migrating an existing gallery2 installation and you want to keep your albums, photos, descriptions, permissions, users, etc. in tact.

  • Turn off the gallery2 URL Rewrite module
  • Backup your g2data directory (to your hard drive).
  • Install gallery2 (import g2data) on the new site.
    • proceed through step 5 (database setup), then copy the following files from your old g2data directory (backup) to your new (and now empty) /g2data directory:
      • /g2data/albums
      • /g2data/sessions
      • /g2data/versions.dat
  • In the database step input the access information for the gallery2 db you just imported.
    • You should be able to select "reuse existing tables"
  • Under "admin user setup" you'll be changing the install password, not the admin password (the admin password is restored from your backup)
  • When you get to the step prompting you to create the config file, the system may identify that your backup is an older version than your new installation.  It should automatically take you to the "upgrader" (separate from the "installer")
  • In the "Systems Check" step of the upgrader you'll need SSH/ shell access to set permissions of your /g2data directory as follows:
    • chown -R webserverUser /home/beernet/g2data/ OR chmod -R 777

If you receive errors when trying to access your album via "edit"

It's a common mistake for people to forget disabling their URL Rewrite module. Whether or not this is your case, log in to your standalone gallery2 installation (usually at /.../public_html/modules/gallery/gallery2), click on "modules" at left, and uninstall URL Rewrite. Re-install it, and configure it again. This should hopefully get things working again. Comment below if you're still having troubles.

If photos upload without error messages but you don't see them

There's nothing more frustrating than having the photo upload finally succeed only to be greeted by a blank picture. Usually you can resolve this by browsing to:

admin > settings > acidfree

and selecting "Force all new images to be transferred by Drupal" under Filemanager Settings at the bottom of the page.

If that doesn't work and you are getting the following error (or a similar one):

No such file or directory in .../core/classes/GalleryPlatform.class ...

then you may need to re-establish the user of your g2data directory as follows:

Important - if you execute this code by creating a page within Drupal make sure to delete it when you're done! Good luck! If you still can't get it to work please post below.

Average: 4.5 (2 votes)
Select your preferred way to display the comments and click "Save settings" to activate your changes.

Why g2data above document root?

In my existing installation, which I think was G1x upgraded to 2x, g2data is under the gallery directory, which is in document root.

In cPanel on my current host, I can't make directories above document root, so please let me know if I need to make a special request...

Thanks,
K

gallery2 security

g2data should be above the document root for security reasons.

Follow this short security checklist:

  • File and directory permissions: Set (chmod) the /gallery2/ folder permissions to 555, and /gallery2/config.php to 444.
  • .htaccess in /gallery2/: You should have an .htaccess file in /gallery2/ containing the following:


    Deny from all
  • storage folder (/g2data/) should not be web accessible: as discussed above, place your g2data folder above your public_html or www folder (outside your document root) so it may not be accessed by the public.

If you can't place the folder above document root, ask your hosting provider to do so. Alternatively, while this method is not as secure, you can place it below the document root and adjust your Virtual Host settings (or ask your hosting provider to do so for you):


# deny access to private directory

Order Deny,Allow
Deny from All

Thanks and an update

First, I want to thank you for posting this howto. By following it, I successfully did an install of Gallery 2.2.1 on a new server and transferred my existing gallery to it. I did encounter an error with the process as shown. In your step "Install Gallery2 on the new site.", you need to include one more subdirectory to copy to g2data: /g2data/sessions.

Additonally, it would be helpful to state in the same section that this is where the old gallery database should be restored from the database dump.

Thanks again
Mark Osborne

Thanks for your suggestions!

Hi Mark,

I'm glad you found this article useful and thanks for your suggestions!  I went ahead and implemented your recommendations Smiling

Cheers,
Alex

Thanks

Thanks for this, it worked a treat!

Gallery2 migration specific to Drupal?

Hi,

This "How To" is very much appreciated Smiling as i have a Gallery2 installation which i need to migrate to a new host and the official documentation is very cryptic and of not much use!

I still have a doubt before i actually go through the process outlined here...is this process applicable to ANY default Gallery2 install or is it specific to Drupal integrated installs?

Thank you very much for your time and stay well!
Sendhil.

Migrating Gallery2

Hi Sendhil,

This was meant for Drupal installations, but may work in general.

Very cool design!

Nice job on the layout Smiling Are you currently using Gallery2 on this website?

Works!

Thanks for this, it worked a treat!

thanks! great article. hope

thanks! great article. hope many people will find it useful. used to find great blogs with useful pieces of information by search engine, but always search for something more. really glad to find good ones. and it really worked!

Forgot to turn off url rewrite module

I did not run across this How To until after I copied the files and uploaded them to the other server. What should I do at this point! Before I break things, thanks.

  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.
  • Textual smileys will be replaced with graphical ones.

More information about formatting options

CAPTCHA
This question is used to make sure you are a human visitor and to prevent spam submissions.