We use cookies
We use cookies to optimize our website. By continuing to browse the site, you agree to our use of cookies.
New design
Control panel
  • Русский
  • Українська
  • English
  • UAH
  • USD
  • RUB
  • EUR
  • 0-800-307-307 Hotline
  • +38 (044) 392-74-33 Kiev
  • +38 (057) 728-39-00 Kharkiv
  • +38 (056) 794-38-31 Dnipro
  • +38 (032) 229-58-93 Lviv
  • +38 (048) 738-57-70 Odessa
  • +38(093) 170-15-42  Life
  • +38 (067) 400-88-44 Kievstar
  • +1(888)393-24-51  USA, Toll free
  • +44(131)507-01-14  Great Britain
  • +7 (499) 348-28-61 Moscow

2.14.4.2. Migrating Yii 2 to Hosting

To migrate a project to Yii 2, you first need to upload the files to the server. This can be done in several ways:

  • In the case of using Git, you can clone the project, connecting to hosting via SSH and running the command:
    git clone http://github.com/example/example_site/
  • Download project files to the server.

After uploading files to the server connect over SSH and do the following:

  1. Customize connection to the database.
  2. Change to the directory with the loaded project by running the command:
    cd ~/example.com/www/
  3. Update dependencies and all packages by running the command:
    PATH=/usr/local/php70/bin:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin
    composer update
  4. Run the command:
    /usr/local/php70/bin/php yii migrate
  5. To include a project as production may be required in file index.php replace lines:
    defined('YII_DEBUG') or define('YII_DEBUG', true);
    defined('YII_ENV') or define('YII_ENV', 'dev');

    For such:

    defined('YII_DEBUG') or define('YII_DEBUG', false);
    defined('YII_ENV') or define('YII_ENV', 'prod');
  6. Check the site is working.

After completing the steps described, additional steps may be required to customize the project. In this case, you should contact the project developer to clarify more detailed information.