Advertising sustains the DA. Ads are hidden for members. Join today

On this page

Multiple Servers

Last updated on
30 April 2025

Here's some advice for handling multiple copies of a drupal site. Say
for example you have a live site, a test site, and development copy.
Each on a different server, and each with nearly identical code and
data. It would be nice to have Facebook Connect work properly on each
copy of the site.

It is important to understand that your Facebook App is configured to
work properly with only one domain. While there is some support for
wildcards (a single app can be configured to work with both
www.example.com and dev.example.com), it is generally better to have
one app exclusively for a live site and other apps for development and
testing. And you'll need to do this when there is no shared domain
(for example if your live site is www.example.com while test site is
test.example.gotpantheon.com).

Now let's say you copy your data from live (www.example.com) to
test (test.example.gotpantheon.com). The first thing you may
notice is that Facebook Connect does not work on test. Why
not? Because the Facebook App is configured to work with a different
domain.

Here's the real danger... you could "fix" your test site
by going to admin/build/fb and clicking "sync props" or editing the
app settings. Then, Facebook Connect would seem to work on
test, but what have you really done? You've broken Facebook
Connect on the live site!
. You see, when you saved
settings on your test server, modules/fb changed the app's properties
on facebook. The app used to work on www.example.com, but now it only
works on test.example.gotpantheon.com. This is what we need to avoid!

Best Practice

Understand that you'll need to use Facebook's Developer Application to create
several applications. One app for each server you plan to support.
For example if your live application is called "Example App", you
might create additional apps called "Example App TEST" and "Example
App DEV".

When configuring the live server...

By default, modules/fb will update properties on facebook when you
save settings on Drupal. This is useful for callback URLs which can
be tricky to get just right. For advanced users, there is a checkbox,
on the application settings form, that disables this. Look for the
checkbox labelled "set application properties automatically."

As a precaution, un-check this checkbox on your live server.
This will make it less likely that the properties will be overwritten
after the database has been copied to another server.

With automatic sync disabled on your live app, you may set
the same properties by clicking the "set props" link on
Admin >> Site Building >> Facebook Applications.

When copying a database from live to test...

Immediately after you copy the database, go straight to
admin/build/fb. Edit all facebook apps, replacing the id and secret
fields with values from a Facebook App intended for use on the test
environment.

If you've unchecked the "set props automatically" feature, you can
check it after you've updated the id and secret. Or, you can click
"sync props" after saving the updated settings.

At this point, your Facebook specific features should be working on
your test server, and you're not in danger of changing the settings
relevant to the live server.

When copying a database from test to live...

Follow exactly the same procedure, but with different id and secret
values.Immediately after you copy the database, go straight to
admin/build/fb. Edit all facebook apps, replacing the id and secret
fields with values from a Facebook App intended for use on the live
environment. Also, uncheck the "set properties automatically"
feature, then click "sync props" after you save your settings.

Help improve this page

Page status: Not set

You can: