Deploying Yii2 app to shared host steps

yoyoma picture yoyoma · Mar 17, 2015 · Viewed 10.7k times · Source

I find it bizarre that there is so little, (if any) details on considerations for deploying a Yii2 app to a shared host server.

Does anyone have some steps, tips, considerations for this ?

Is there a process you follow that keeps issues/errors down to a minimum ?

How does the DB get migrated (with data)? I'm assuming I could do export/import of the DB, copy the Yii app folder directly, but that seems too simplistic ?

Answer

Mihai P. picture Mihai P. · Mar 18, 2015

First read this page http://www.yiiframework.com/doc-2.0/guide-tutorial-shared-hosting.html

Regarding the files yes, just copy them. If your host allows you ssh access (but not git) you can have them copied very fast with rsync (so you can use composer etc on your computer and deploy through ssh). I have done a similar script that does the same thing with FTP at 1 point but it was much slower. Since I have stopped making websites for shared hosting.

Regarding the migrations you can make them run from the browser too for example How to handle yii2 migrations on hosts without console access? Make sure you read the answer and the comments too and follow that link.