Categories
Programming

Running PHP applications on Heroku

These last weeks I’ve been working on trying to organize my domain names and web hosting accounts. I’m running this blog and several other websites on a VPS as a WordPress multisite. The other applications that I am running are small PHP applications. I’ve been looking into running the other applications on Heroku. By moving these away from my current web hosting account I can cancel that account and use it for domain names and their DNS control panel.

If you would like to try running PHP applications on Heroku I suggest you create an account and create a new app at the Cedar stack (for PHP support). Then sign up for an account at Amazon S3. I use Amazon S3 for their cloud storage and keep my transfers and data (less than 5 GB) beneath their free tier to keep my costs minimal. To stay at Herokus free tier you can’t store more than 5 MB for the MySQL database and not more than 10 000 rows on the Postgres database. The PHP applications I’m running at Heroku is using MySQL as a database backend and databases at Heroku can get costly fast, especially when using several dynos.

If you’re not running your PHP application in the webroot, take a look at https://github.com/winglian/Heroku-PHP for instructions on how to change the webroot at Heroku.

Advantages

  • Easy to deploy, my old hosting service didn’t support SSH access or any other way to do a proper deployment.
  • Cheap (maybe even free…?) for small applications.
  • Minimal maintenance since I don’t have to administer a VPS.

Downsides

  • If you start adding dynos, it gets really expensive.
  • Your Ruby on Rails applications on the free account winds down after idling for a while and has a startup time that feels like forever. That doesn’t happen for the paid accounts. This doesn’t apply on PHP applications though.

After doing this test run, I will definitely look into running this WordPress Multisite at Heroku instead of having my own VPS.