Getting started with PHP app development on PHP Fog

This is basic tutorial for getting started with PHP app development on PHP Fog.


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




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 app on PHP Fog
III. Generate your SSH key
IV. Create app's clone
V. Import app into Eclipse
VI. Setup XAMPP
VII. 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 app on PHP Fog
  1. Access PHP Fog and sign up. https://phpfog.com/account
  2. Choose plan. (If you want to use cloud for free, choose shared plan.)
  3. Register your app's profile.
    You can select some apps or frameworks. Choose the app or the framework you like.
    If you'll develop simple PHP app, choose custom PHP app.
III. Generate your SSH key
  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
    
  4. Register your SSH Pub key into your PHP FOG Account
    Open your id_rsa.pub file and copy the entire text then access your account in PHP FOG and paste it.
IV. Obtain your app's clone from PHP Fog
  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@git01.phpfog.com:your_project_dir
    Cloning into 'your_project_dir'...
    The authenticity of host 'git01.phpfog.com (50.17.200.54)' can't be established.
    RSA key fingerprint is [Hex].
    Are you sure you want to continue connecting (yes/no)? yes
    Warning: Permanently added 'git01.phpfog.com,50.17.200.54' (RSA) to the list of known hosts.
    Identity added: /Users/xxx/.ssh/id_rsa (/Users/xxx/.ssh/id_rsa)
    remote: Counting objects: 3, done.
    Receiving objects: 100% (3/3), done.
    remote: Total 3 (delta 0), reused 0 (delta 0)
    
  5. You'll see your app clone in your project dir.
  6. side7:php xxx$ cd your_project_dir
    side7:your_project_dir xxx$ ls -la
    total 8
    drwxr-xr-x   4 xxx  staff  136 Feb 17 21:35 .
    drwxr-xr-x   6 xxx  staff  204 Feb 17 21:34 ..
    drwxr-xr-x  13 xxx  staff  442 Feb 17 21:35 .git
    -rw-r--r--   1 xxx  staff   30 Feb 17 21:35 index.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 project then select "share project" from [team] in context menu.
  3. 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 and .settings/ into .ignore.
VI. 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 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_project_dir"
      ServerName localhost
    
    
    #
    # Enable AcceptMutex flock for using vhosts
    #
    AcceptMutex flock 
  5. Access http://localhost:5000/. You'll see Hello World.

VII. 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.
VIII. Congratulation!
Access your app on PHP Fog!!

Useful links

4 comments:

  1. I think this is really good tips for beginners and they should learn from it because if you want a highly professional and Dedicated PHP Developers so you have to work hard and learn all the tactics which do while developing.
    Malaysia Website Design Company

    ReplyDelete
  2. the above list was really helpful for me but i will be still waiting for some more PHP Developers.

    Facebook App Development

    ReplyDelete
  3. Hii.. it seems a good information for all business holders. One must always look for a PHP developer who has gained significant experience by developing diversified projects, as it will help one to gauge the skills and expertise of the developer.

    ReplyDelete
  4. Hi, thanks for this very nice and interesting post. I like your writing style, it’s quite unique. Please visit https://goo.gl/Za2Qf4

    ReplyDelete