Manage cookies that are used for advertising, such as ad personalization, remarketing, and ad effectiveness analysis.
2.8.4.4.2. Transfer Yii 2 to hosting
Attention!
The information provided in this article is for informational purposes only. Transferring a project built on Yii 2 to a hosting environment is quite complex and involves certain nuances that only the project’s developer can anticipate.To transfer a project on Yii 2, you first need to upload the files to the server. There are several ways to do this:
- If you're using Git, you can clone the project by connecting to the hosting via SSH and running the following command:
git clone http://github.com/example/example_site/ - Upload project files to the server.
After uploading the files to the server connect via SSH and perform the following steps:
- Configure the database connection.
- Go to the directory containing the downloaded project by running the following command:
cd ~/example.com/www/ - Update dependencies and all packages by running the following command:
PATH=/usr/local/php70/bin:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin composer update - Run the following command:
/usr/local/php70/bin/php yii migrate - To set the project to
productionmode, you may need to replace the following lines in theindex.phpfile:defined('YII_DEBUG') or define('YII_DEBUG', true); defined('YII_ENV') or define('YII_ENV', 'dev');To this:
defined('YII_DEBUG') or define('YII_DEBUG', false); defined('YII_ENV') or define('YII_ENV', 'prod'); - Check the site operation.
After completing the steps described above, additional steps may be required to configure the project. In this case, please contact the project developer for further details.