how to setup facebook php client library on Amazon EC2 AMP AMI

before you begin, have a quick look at the opensolaris AMP AMI(Amazon Machine Images) catalog

Following are the steps for setting up facebook application development platform on amazon ec2 AMP AMI.

[ step 1]
Launch ec2 instance using the AMI ID (ami-45f1152c) and get the instance id

bash # ec2-run-instances -k <your-keypair> ami-45f1152c

[ step 2]
get the public dns address of the instance using the instance id

bash # ec2-describe-instances <i-xxxxxxxx>

[ step 3]
make ssh connection to the instance.

bash # ssh -i <keypair file>

[ step 4]
download Official PHP client library from

bash # cd /var/apache2/2.2/htdocs/
bash # wget

[ step 5]
extract the platform library and place it at appropriate location

-bash # pwd
bash # gunzip facebook-platform.tar.gz
bash # tar -xf facebook-platform.tar
bash # rm facebook-platform.tar
bash # cd facebook-platform/
bash # mv client/ facebookphp/
bash # mv facebookphp/ /usr/lib/

[ step 5]

make necessary changes in the php.ini file located at /etc/php5/5.2/php.ini
add “/usr/lib/facebookphp” path in the include_path variable.

after the change it should look like this

include_path = ".:/var/php/5.2/pear:/usr/lib/facebookphp"

enable the short_open_tag, so that you can run sample facebook application correctly without any error.

after the change it should look like

short_open_tag = On

[step 6]

restart the apache to apply the changes done in the php.ini file.

bash # svcadm restart svc:/network/http:apache22

[step 7]

arrange directories and perform clean up.

bash # cd /var/apache2/2.2/htdocs/facebook-platform
bash # mv footprints/ ../
bash # mv README ../footprints/
bash # cd ..
bash # pwd
bash # rm -rf facebook-platform/

[step 8]
change the include path in the sample footprint application as we no longer require relative path for the client library.Library path is already included within the php.ini file.

bash # cd footprints/
bash # vi index.php


// the facebook client library
include_once '../client/facebook.php';


// the facebook client library
include_once 'facebook.php';

[step 9]

facebook php client library is now installed and necessary changes has been applied to the sample footprint application.

follow the Readme file located at /var/apache2/2.2/htdocs/footprints/README to begin testing facebook application on amazon ec2.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s