Developing Facebook Applications on OpenShift: Getting Set Up

Are you ready to build an awesome Facebook Application and host it on OpenShift? Good, then let’s get started!

There are a few steps you need to complete before you can begin building Facebook Applications on OpenShift, lets go ahead and get them out of the way now.

Get an OpenShift Account

First you need to sign up for a free account on so you have a place to host your application. Then install the OpenShift rhc client tools (or you can use the web console). If you need help installing the rhc client tools, please see this article.

Become a Facebook Developer

Next you need to sign up for an account on Facebook and then enroll in the developer program. Note that you will have to verify your account by adding a credit card number or phone number before you can build Facebook applications. Go ahead and go complete those two steps and I’ll wait for you here.

Get Down to Business

Now that you have your account and your Facebook Developer accounts, we can get down to business.

We are going to break this process down into three easy steps.

  1. Create your OpenShift gear which will house the web pages and database that we are going to use for our Facebook Application.
  2. Setup our application in the Facebook Developer Portal and connect it to your gear.
  3. Write an awesome application that everyone on Facebook will want to use.

Step 1 – Creating your OpenShift gear

If you don’t already have the OpenShift rhc client tools installed, please see the link at the top of this blog post about how to get them installed.
We are going to create one gear that will house our web pages (using PHP). We do this by issuing the following command:

rhc app create openshiftquiz php-5.4

If you see some text that looks like this:

The authenticity of host ' (' can't be established.
RSA key fingerprint is xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx.
Are you sure you want to continue connecting (yes/no)?  

Just type yes and hit enter.

You will see something like the below which will show you that your application was created, and showing your database credentials.

Application Options
Domain:     facebookapp
Cartridges: php-5.3
Gear Size:  default
Scaling:    no
Creating application 'openshiftquiz' ... done
Waiting for your DNS name to be available ... done
Creating application 'openshiftquiz' ... done
Waiting for your DNS name to be available ... done
Cloning into 'openshiftquiz'...
Warning: Permanently added the RSA host key for IP address '' to the list of known hosts.
Checking connectivity... done
Your application 'openshiftquiz' is now available.
  SSH to:
  Git remote: ssh://
Run 'rhc show-app openshiftquiz' for more details about your app.

Step 2 – Creating your Facebook Application and connecting it to your OpenShift gear

Now that your OpenShift gear has been created, and the basic code has been cloned to your local computer, lets setup your Facebook application and connect it to your gear.

First you need to visit the Facebook Developer Portal, then click on “Apps” on the top menu, and then “Create a New App”
Create new Facebook application on OpenShift screenshot

Next you will need to choose a Display Name and Namespace for your application. The namespace is part of the URL that people will see when using your application. You will also need to choose a Category and Sub-Category for your application.
Fill out Facebook application form fields screenshot

You will then be shown some information about your application that has been created such as your App ID, App Secret, etc. Click on the “Settings” button on the left menu to finish setting up your application.
Facebook application settings screenshot

After you are on the settings page, you will need to click the “Add Platform” button so that we can link this application to our OpenShift gear.
Facebook application Add Platform button screenshot

You will get another screen with a whole bunch of application types listed. For this demo we are going to choose the “App on Facebook” type by clicking on it in the top left corner.
Facebook Select Platform screenshot

Now it’s finally time to link this application to our OpenShift gear. Go ahead and enter the URL of the gear that you created in step one in the “Canvas URL” text field, and the same URL in the Secure Canvas URL field, except use https instead of http in the second box as shown in the below screenshot. Make note of the “Canvas Page” URL at the top of this page, this is the URL that users will use to visit your application, and the URL you can use to test your application in the next step.
Fill in OpenShift application urls screenshot

Once you have clicked the “Save Changes” button at the bottom right of the page, you can visit the “Canvas Page” URL that you noted in one of the previous steps and see the “Welcome to your PHP application on OpenShift page. Now we are finished connecting our Facebook application to our OpenShift gear.
Show OpenShift application inside of Facebook canvas application screenshot

Next Up

Now that we have our Facebook Application hooked up to our OpenShift gear, let’s move on to the fun part.

Next time we’ll show you how to get your PHP application talking to Facebook in “Developing Facebook Applications on OpenShift: Launch Your App“.

Next Steps

OpenShift Online, PHP
Comments are closed.