Grzegorz
Krysiak
CTO @ DocPlanner
This is the place where I share my experiences, thoughs any other weird stuff.
Follow @grzegorzkrysiak
  • Simple PHP application on Heroku

    0 Comments Written 3 years ago
    • Tweet

    Heroku is a simple and easy to use platform for deploying application written in Ruby, Node.js, Python and Java. It also has many extensions which enable using many popular services like in example Redis, Mongo, Elastic, Postgres. In one sentence, Heroku is very simple and not expensive (free in some cases) platform for your startup.

    And what about PHP? You can use it with Heroku and it works exactly as it should. PHP does’t have official support, but why it has to be a problem :)

    How to deploy PHP application on Heroku in 5 minutes?

    First, you need to have all required boring stuff: Heroku account, local git installation and Heroku toolbelt

    Second, create application scaffold:

    mbp~/$ mkdir heroku-app
    mbp~/$ cd heroku-app
    mbp~/heroku-app$ echo "<?php phpinfo(); ?>" > index.php
    

    … and push to Heroku

    mbp~/heroku-app$ git init
    mbp~/heroku-app$ git add .
    mbp~/heroku-app$ heroku create heroku-app-123 
    mbp~/heroku-app$ git commit -m "initial import”
    mbp~/heroku-app$ git push heroku master
    

    … it’s done! (git push deployed application automatically)

    mbp~/heroku-app$ heroku open
    

    opens your application here heroku-app-123.herokuapp.com. Tada!!! :)

    Useful advice: to change PHP enviroment configuration on Heroku, all you have to do is add php.ini file to the root dir of an application and inside it, define parameters which has to be changed ie. max_execution_time = 60