Search code examples
phpmysqlsqldeploymentcreate-table

Deploying a small PHP + MySQL service


I am deploying a small PHP + MySQL service to my client and would like to know what is the proper way to set up the database:

  • Should I use the hosting provider control panel and create the database schema?
  • Or should I put SQL CREATE scripts in my PHP to run during the "init phase"? Do hosting providers even allow PHP to create tables?

It's a really small site, one tiny info page and one web service page for fetching data from the database.


Solution

  • I usually offload all deployment tasks into an install script. This way you can deploy in a matter of seconds, and can repeat if necessary. I do not know of a way to restrict scripts from database modifications (other than mysql user permissions, which will typically be defined by you)