Deploying your PHP / apache webapp in under a minute with Hasura

This post will help you deploy a webapp that you’re writing with PHP and apache onto the cloud in just a few clicks.


  1. You know git basics.
  2. You know how to get your ssh key that git uses (eg: if you set up a github account and are able to git push to your github repo without entering a password every time, you already know this. But here’s a reference in case you don’t).

1. Create a Hasura project

First, get yourself a free Hasura project by registering on and clicking on the ‘Activate’ button.

2. Login to your console and add your SSH key

Login to your project console using the credentials you would have received over email once you activated the project.

Login to your console.

Now get your SSH key. Here are some examples of how you could get your SSH key on different OSes:

Once you have your SSH key, paste it into the console by heading to the advanced section (click on the ⚙ icon on the left sidebar):

3. Setup a php-apache based git repo for your work

3.1 Clone the quickstart repo to your computer:

3.2 Copy the php-apache folder to create your own app folder

cp -r quickstart-docker-git/php-apache webapp

3.3 Initialise a new git repo in your own app folder

cd webapp/
git init
git add .
git commit -am 'Adds base repo files'

This app folder contains a basic ‘Hello world’ HTML webapp. You can see the source files in: app/src. Eg: the HTML file is: app/src/index.php.

4. Create a subdomain on your hasura project for your webapp

Head to the create service section (click on the ➕ icon the sidebar) and add a service as shown on the left.

After you click on create, you will automatically be redirected to the manage app page:

Manage app page.

5. Git push and deploy your webapp

5.1 Head to your git repo (webapp) that you created in step 3

cd webapp

5.2 Add a new git remote

Copy the git remote command from the manage app page. In this case, my project is lumber59, and so:

git remote add hasura ssh://

5.3 Push this git repo to hasura

git push hasura master

This is what a successful git push will look like on the terminal:

5.4 Check out your deployed app:

Head to app.<project-name> In my case, I head to:

6. Make a change and deploy again

To make a change to your project, change files in the app/src/ directory. For eg, I changed app/src/index.php and added another key to the JSON object that is echo'd.

Commit and push again:

git commit -a 'Made some new changes'
git push hasura master

And after a successful push, your app will be live again:

Hasura also helps you add backend APIs to your PHP apps in minutes. Get started here: