Saturday, 17 August 2013

PHP on Heroku

Heroku allows you to host your php applications free of cost , until your user base increases . This is hence a good place to host ,if you are testing out your application in the market.

Heroku requires GIT which is version control tool, which allows you to track changes you have made to your code.

Lets begin,

Install GIT

Linux users can try the   $sudo apt get install git


You also need to have a Heroku account ,go here


Then install the heroku toolbelt , its a command line interface to upload codes onto heroku; For this go here.  Linux users can  do so by running

$wget -qO- https://toolbelt.heroku.com/install-ubuntu.sh | sh



login to your heroku account from the terminal by
$ heroku login





Go to the directory/folder where you have developed your php application.
Then run   $ git init


This creates a new subdirectory named .git that contains all of your necessary repository files — a Git repository skeleton


You can add all the content in the directory to the git repository by
$ git add .


Once done , commit it by
$ git commit -m "message"




Then run  $ heroku create  . First time users will be asked to add a key, verify the rsa key, the key for git being  16:27:ac:a5:76:28:2d:36:63:1b:56:4d:eb:df:a6:48


Push the commited code to heroku by
$ git push heroku master




Then run      $heroku open   



It should open up your php application in the default browser !!!





Note , If you make any changes in your code later on, just commit it by 'git commit'  and push it to heroku by 'git push heroku master'

No comments:

Post a Comment