Working with Databases on Heroku

Heroku uses a relational database management system (RDBMS) name PostgreSQL for its projects. Unfortunately, there is not a lot of documentation on how to use Heroku’s databases with a PHP application (though there is a lot for using Ruby and nodeJS). Fortunately, I have worked through some of the issues that will come up in using PostgreSQL on Heroku with a PHP application.

By default, PHP applications do not get a database automatically created when the project is initiated (Rails projects do). The first step is to create a shared-database with the heroku command-line interface, as shown in Listing 11–9.

Listing 11–9. Adding a Database to a Heroku Project

heroku addons:add shared-database -----> Adding shared-database ...

Get Beginning Facebook Game Apps Development now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.