Deploy PHP to Heroku

Heroku is famous as a Ruby hosting platform, supporting frameworks such as Ruby on Rails and Sinatra. They also advertise that they support, Java, Python, Clojure, Scala, Node.js and Play. Although what is rarely mentioned within the documentation is that Heroku supports PHP.

Here's how you get PHP running on Heroku in minutes:

First make sure you have a Heroku account, git installed locally and the Heroku toolbelt setup.

Create a directory for your app:

mkdir heroku-php
cd heroku-php

Create a sample PHP file called index.php:

<?php
  phpinfo();
?>

Create a git repo, create a Heroku app, and push:

git init
git add .
heroku create
git commit -m "Initial commit"
git push heroku master

Done! you can now open your app using the heroku open command, and view all the wonderful PHP information about your Heroku environment.

Published on: 05 April 2013
By
Tags: php, heroku,

Twitter