Getting started with Facebook app(PHP) development on Heroku

This is basic tutorial for getting started with Facebook app(PHP) development on Heroku.


What I'll introduce
This is quick introduction how to develop Facebook app(PHP) with Heroku.
In this tutorial, the environment consists of Eclipse, XAMPP and web browser in Local, and using Git for uploading to Heroku.




My environment consists of
  • Mac OS X 10.7
  • Eclipse Helios
  • XAMPP 1.7.3
  • Git 1.7.8.4
Steps
I'll introduce by below steps.
I. Installing development environment
II. Create your Facebook app on Heroku
III. Generate your SSH key
IV. Create app's clone
V. Import app into Eclipse
VI. Setup your app on Eclipse 
VII. Create your debug app on Facebook 
VIII. Setup XAMPP
IX. Development and push
I. Installing development environment
  1. Get Eclipse and install it. http://www.eclipse.org/
  2. Get PDT(PHP development tool) from your Eclipse and install it.
  3. Get EGit from your Eclipse and install it.
  4. Get XAMPP and install it. http://sourceforge.net/projects/xampp/
  5. Get Git and install it https://code.google.com/p/git-osx-installer
#When install application from Eclipse, select Install New Software from [Help] menu. Then select "Helios - http://download.eclipse.org/releases/helios" in the "work with" URL and select software you want to install.
II. Create your Facebook app on Heroku
  1. Access Facebook Developers and click "Apps" then register your app name.
  2. Get cloud service and select Heroku.
  3. Select environment and fill in your e-mail address then go to your app on Heroku.
    # If you haven't had your account on Heroku, the account will be created automatically. And then follow the navigation to activate your account.
  4. You'll see your app on Heroku. Check your app name.

III. Generate your SSH key(If you haven't had yet)
  1. Create .ssh directory in your home dir, if you don't have it yet.
    side7:~ xxx$ mkdir ~/.ssh
    side7:~ xxx$ cd ~/.ssh
    
  2. Generate your SSH key in your .ssh dir.
    side7:.ssh xxx$ ssh-keygen -t rsa
    
    Generating public/private rsa key pair.
    Enter file in which to save the key (/Users/xxx/.ssh/id_rsa):
    Enter passphrase (empty for no passphrase):
    Enter same passphrase again:
    Your identification has been saved in /Users/xxx/.ssh/id_rsa.
    Your public key has been saved in /Users/xxx/.ssh/id_rsa.pub.
    The key fingerprint is:
    [HEX KEY such as 4b:32:...........] xxx@side7.local
    The key's randomart image is:
    +--[ RSA 2048]----+
    [image]
    [image]
    [image]
    [image]
    [image]
    [image]
    +-----------------+
    
  3. Check your SSH key
    side7:.ssh xxx$ ls
    id_rsa        id_rsa.pub
    
IV. Obtain your app's clone from Heroku
  1. Move your project directory where you like.
  2. side7:php xxx$ cd /Users/xxx/dev/php/
    
  3. Clone your app repository.
  4. side7:.php xxx$ git clone git@heroku.com:your_app_name.git -o heroku
    Cloning into 'your_app_name'...
    Warning: Permanently added the RSA host key for IP address '50.19.85.156' to the list of known hosts.
    remote: Counting objects: 172, done.
    remote: Compressing objects: 100% (104/104), done.
    remote: Total 172 (delta 78), reused 132 (delta 62)
    Receiving objects: 100% (172/172), 136.82 KiB | 33 KiB/s, done.
    Resolving deltas: 100% (78/78), done.
    
  5. You'll see your app clone in your project dir.
  6. side7:php xxx$ cd your_app_name
    side7:your_app_url xxx$ ls -la
    total 72
    drwxr-xr-x  13 kensaku  staff    442 Feb 27 22:02 .
    drwxr-xr-x   8 kensaku  staff    272 Feb 27 22:01 ..
    drwxr-xr-x  13 kensaku  staff    442 Feb 27 22:02 .git
    -rw-r--r--   1 kensaku  staff     86 Feb 27 22:02 .gitmodules
    -rw-r--r--   1 kensaku  staff   1300 Feb 27 22:02 AppInfo.php
    -rw-r--r--   1 kensaku  staff   1579 Feb 27 22:02 Readme.md
    -rw-r--r--   1 kensaku  staff     60 Feb 27 22:02 channel.html
    drwxr-xr-x   8 kensaku  staff    272 Feb 27 22:02 images
    -rw-r--r--   1 kensaku  staff  13846 Feb 27 22:02 index.php
    drwxr-xr-x   3 kensaku  staff    102 Feb 27 22:02 javascript
    drwxr-xr-x   2 kensaku  staff     68 Feb 27 22:02 sdk
    drwxr-xr-x   6 kensaku  staff    204 Feb 27 22:02 stylesheets
    -rw-r--r--   1 kensaku  staff    275 Feb 27 22:02 utils.php
    
V. Import your project(clone) into eclipse as PHP project
  1. Create PHP project in your Eclipse.
    Create new PHP project in your Eclipse at your app clone.
  2. Share your project
    Open 
    explorer view and select project then select "share project" from [team] in context menu.

VI. Setup your app on Eclipse
  1. Obtain and Import Facebook PHP SDK into your app project.
    Get Facebook PHP SDK from Facebook php-sdk git hub and deploy it in your_app_project/sdk/src.
  2. Create and set .gitignore file.Open explorer view and select .buildpath file then select "add .igonre" from [team] in context menu. Also add .ignore, .project, sdk/ and .settings/ into .ignore.
VII. Create your debug app on Facebook
  1. Access Facebook Developers again and click "Apps" then register your debug app name such as "your_facebook_name debug".
  2. Set your debug app url for local access like http://127.0.0.1:6000

VIII. Setup XAMPP
  1. Move to XAMPP conf dir and open httpd.conf as root.
  2. side7:~ xxx$ cd /Applications/XAMPP/etc
    side7:etc xxx$ sudo vi httpd.conf
    Password:
    
  3. Configure virtual host settings and Facebook app settings in httpd.conf.
    Add below settings under "Listen 80"
  4. Listen 5000
    
    #
    # Virtual host configurations start from here
    #
    NameVirtualHost *:80
    NameVirtualHost *:5000
    
    
      DocumentRoot "/Applications/XAMPP/xamppfiles/htdocs"
      ServerName localhost
    
    
    
      DocumentRoot "/Users/xxx/dev/php/your_app_name"
      ServerName localhost
      SetEnv FACEBOOK_APP_ID your_app_id_for_real
      SetEnv FACEBOOK_SECRET your_app_secret_for_real
    
    
    #
    # Enable AcceptMutex flock for using vhosts
    #
    AcceptMutex flock 
  5. Access http://localhost:5000/ You'll see Facebook app template same as you've seen on Heroku.

IX. Development and push your source code
  1. Modify index.php and enjoy development.

    ENJOY DEVELOPMENT!!
  2. Commit your change to your local repository.
    Select  "Commit" from [team] in context menu and select then fill in your comment and commit.
  3. Push your change to your remote repository.
    Select "push" from [team] in context menu.
IIX. Congratulation!
Access your app on Heroku!!

Useful links

39 comments:

  1. Brilliant tutorial type is amazing to me. Thanks.

    Facebook Development

    ReplyDelete
  2. Nice post to devlop own facebook. I really like that. Thanks for this post.


    php developer india

    ReplyDelete
  3. Wonderful.... I really like that.

    Thanks you for sharing with us this kind of information.........
    Sigma Solve

    I truly like to reading your post. Thank you so much for taking the time to share such a nice information.

    Really great and impressive post, I really search this type of topic and really appreciate it. Thanks!

    ReplyDelete
  4. Am struck at

    VI. Setup your app on Eclipse

    Create and set .gitignore file.Open explorer view and select .buildpath file then select "add .igonre" from [team] in context menu. Also add .ignore, .project, sdk/ and .settings/ into .ignore.


    how do we create and set .gitignore file ??

    ReplyDelete
    Replies
    1. >deep
      Thanks for your comment.

      Just create ".gitignore" file as new file into your project.
      Then you can "add .ignore" with the right click menu.

      You can also set ignore settings with direct writing on .gitignore file without using "add .ignore" menu.

      Delete
  5. Thank you for sharing this, It will help people to know about Facebook Application Development

    ReplyDelete
  6. This comment has been removed by the author.

    ReplyDelete
  7. your blog really break all of my suspicion about php language.thanks for posting.
    php developer

    ReplyDelete
  8. You can get start facebook app development from the post here. Have a look at it

    Web Design Company Singapore

    ReplyDelete
  9. Facebook application has been a huge success for Facebook. You will find numerous applications on Facebook, which includes games, photo editor, fun and many others.

    Facebook Apps

    ReplyDelete
  10. Nice information, many thanks to the author. It is incomprehensible to me now, but in general, the usefulness and significance is overwhelming. Thanks again and good luck!

    Mobile Application Developer Company

    ReplyDelete
  11. Best and Nice Information for the looking best Please look My website web development company india

    ReplyDelete
  12. I appreciate your post. It contains a great description about the Facebook app. One can easily apply this and get the experience of using php to make a Facebook app.

    php developer india

    ReplyDelete
  13. These kind of courses are very important to the society that we live in if these kind of courses were start before the situation was much batter

    Website Hosting
    Hosting Services Karachi

    ReplyDelete
  14. Actually Facebook applications developer purpose is to generate more traffic as well as visitors to the website. When you are finding the Facebook Applications Developer you must not depends on website developers because website developer work is different as compare to Facebook application developer as an alternative you must look for social media programmers. For develop the best Facebook app your developer should be expert developer of the social media apps.

    ReplyDelete
  15. Using an all inclusive requisition for all these three - iPhone, ipad and iPod is an incredible thing. The code to change over and requisition into widespread provision might be really supportive.
    iPhone App Builder // Andriod Application Development // Andriod APP Development

    ReplyDelete
  16. thanks you for your share. And now, my blog is beautiful

    development Services

    ReplyDelete
  17. Nice post i really like this post.thanks to sharing this post.click here

    ReplyDelete
  18. A lot of PHP developers are a big fan of their PHP framework, and there so many frameworks from which it becomes difficult to choose. Among the most popular ones are, CakePHP, Symfony, Yii, CodeIgniter framework whereas the young ones are stuck on the block Slim, Lithium, Silex and Laravel.

    ReplyDelete
  19. Hi, thank you for your great post. I really appreciate the efforts you have put in your blog .It is interesting and helpful. Good luck with it!!! Yii Development

    ReplyDelete
  20. i saw this post awesome i am interesting your post.........................................................nice Website Development in india

    ReplyDelete
  21. Hi, PHP is a server-side general purpose scripting language used for web development, which is used in almost all personal blogs. It is a very easy to understand language that can be easily learnt with a proper PHP Training in Chennai. You can join a course at FITA, where the best PHP Training in Chennai is taken, and excel as a web developer.

    ReplyDelete
  22. PHP or Hypertext Preprocessor is the most preferred programming language in the world, used for dynamic website
    development and web based applications. This server side scripting language has been used to develop some of the
    most popular website such as Facebook and Wikipedia.
    php

    ReplyDelete
  23. On the web development market it is commonly believed that custom programming is not longer popular service and clients prefer to to deal with stable
    open-source products instead of starting a totally new development.

    développement sur mesure .net

    ReplyDelete
  24. his is an amazing blog,it gives very helpful messages to us.Besides that Creationinfoways has established himslef as Top 10 seo company in delhi as well as Top 10 website Development company in delhi.Now newly indroduced himself as one of the best growing Digital marketing company in delhi and Ecommerce Website Development Company in Delhi.

    ReplyDelete
  25. Website design company in australia is provide very good web design facility in australia we also provide the seo services in australia.
    custom web design sydney

    ReplyDelete
  26. Appaustic- we are able to provide a full variety of fb application strategy, design, development and advertising for your business.Facebook app development company

    ReplyDelete
  27. I’m really impressed with your blog article, such great & useful knowledge you mentioned here
    Facebook app development company

    ReplyDelete
  28. Marvelous, what a webpage it is! This webpage presents
    helpful information to us, keep it up.
    Online Marketing Essex
    Seo Consultant Essex

    ReplyDelete
  29. This is quite educational arrange. It has famous breeding about what I rarity to vouch. Colossal proverb. This trumpet is a famous tone to nab to troths. Congratulations on a career well achieved. This arrange is synchronous s informative impolite festivity to pity. I appreciated what you ok extremely here.
    Core Java interview questions and answers

    Java training in Chennai | Java training in Tambaram

    Java training in Chennai | Java training in Velachery

    Java training in Chennai | Java training in Omr

    ReplyDelete
  30. I have read a few of the articles on your website now, and I really like your style of blogging. I added it to my favourites blog site list and will be checking back soon.
    python training in rajajinagar
    Python training in bangalore
    Python training in usa

    ReplyDelete
  31. Wow, nice information like your way of explanation, it can be easily understanding.

    Best Microsoft Training in Bangalore for Microsoft, we provide the Microsoft training project with trainers having more than 5 Years of Microsoft training experience, we also provide 100% placement support.

    ReplyDelete