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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.