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
http://developer.amazonwebservices.com/connect/entry.jspa?externalID=1692

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> ec2-xx-xxx-xxx-xxx.compute-1.amazonaws.com

[ step 4]
download Official PHP client library from http://wiki.developers.facebook.com/index.php/PHP

bash # cd /var/apache2/2.2/htdocs/
bash # wget http://developers.facebook.com/clientlibs/facebook-platform.tar.gz

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

-bash # pwd
/var/apache2/2.2/htdocs

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/
cd ..
bash # pwd
/var/apache2/2.2/htdocs

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

change

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

to
// 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.
Comments:

Post a Comment:
  • HTML Syntax: NOT allowed
About

Divyen Patel

Search

Categories
Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today