host php web application

In this tutorial, I am going to discuss how you can host PHP web application in Heroku cloud. If you are developing a web project and you’re looking to host your web application from your local webserver to hosting server (i.e) production servers I will recommend you to use Heroku to deploy your project to become live.

What is Heroku?

Heroku is a cloud platform as a service supporting several programming languages. One of the first cloud platforms, Heroku has been in development since June 2007, when it supported only the Ruby programming language, but now supports Java, Node.js, Scala, Clojure, Python, PHP, and Go (Source)

How to create Heroku account?

  • Go To
  • Fill all the required fields and complete the captcha.
  • After that click Create free account button.
  • You will receive a verification email in your inbox.
  • Click the verification link to verify your Heroku account.
host php web application
host php web application

Create new Heroku app

  • Login to your Heroku account using
  • Click Create New app.
  • Enter your App name (It must be a unique name).
  • Choose the Region and click Create App.

Requirements to deploy your PHP web application on Heroku

Download and install this three requirements in your system.

Creating “Hello World” PHP web application

As per the law of programmers “Hello World” application is the initial application for testing purposes.

  • Create a New directory anywhere in your system.
  • Move to the directory and create a file “index.php”.
  • Open index.php file using your favorite IDE.
  • Echo out the string Hello world.


echo "Hello world";


Deploying “Hello World” application in Heroku app

In this part we are going to use some command in Heroku CLI. Don’t be afraid of commands it is simple to deploy using Heroku CLI.

  • Open Heroku CLI that we installed already in our system.
  • Move to the directory that we create our index.php application.
  • Now you need to login to your account using Heroku CLI.
  • Type commandheroku login and hit enter.
  • Type command git init this will Initialize a git repository in a new or existing directory.
  • Then type heroku git:remote -a <Your app name>
  • Now we will need to commit our app with git repository.
  • Type the below commands one by one.
  • git add .
  • git commit -am "make it better"
  • git push heroku master
  • Now your app is successfully deployed.

To check your app visit

In addition to you can also use MySQL database for free in your application by adding Heroku add-on

Also read:

How to Turn into a Digital Marketing Jobs Master

How To Make USSD Money Transaction Without Internet


Please enter your comment!
Please enter your name here