I have been asked about the procedure for hosting Yii2 on the Cloudways platform.
I am sharing this step-by-step guide on how you can use Composer to install Yii2 framework on the Cloudways platform, with the hope that the users would find it easy to launch Yii2 projects without any issues.
What is Yii2?
Yii2 is the latest version of the Yii framework and is basically a rewrite of Yii on top of PHP 5.4.0.
For installing Yii2 on Cloudways web hosting for PHP, you need to have a Cloudways account. It’s easy to sign up and takes up only a few minutes of your time. Cloudways is a great option for agencies, bloggers, website owners, and those who are looking for reliable and speedier load times on their websites.
Reference: Builtwith, May 2021
Before you get started, sign up or log in to the Cloudways platform.
Yii 2 Prerequisites:
- A running instance of the webserver.
- A LEMP stack with PHP 5.4.0 or above.
- A Composer – an application-level package manager for PHP.
- Let’s get started:
- Launch Your Server
- Log in to your Cloudways account and click on Launch server.
Nothing as Easy as Deploying Yii Apps on Cloud
With Cloudways, you can have your PHP apps up and running on managed cloud servers in just a few minutes.
Launch Your Server
Log in to your Cloudways account and click on Launch server.
Select your Application
Now that you are on the Launch Server page, select your application as PHP Stack. Fill in your application name, Server name, and project name.
Click Launch Now and wait for a few minutes for the optimized PHP application to be deployed on the Server.
After completing all these steps, you can finally navigate to the application tab and select the Yii application. Click on it to find further details inside:
Launch SSH Terminal
Now go to the Server Management tab and click on Launch SSH terminal.
Login in your terminal with the username and password provided in Master Credentials.
Install Yii2 on Cloudways
To install Yii2, We have to downgrade our composer because the Cloudways default composer is version 2.0 and the Yii framework supports version 1.0.
Type the following commands to install composer version 1.0.
cd /home/master/ && wget https://getcomposer.org/download/1.10.17/composer.phar chmod +x composer.phar mv composer.phar composer
Now I would access the public_html folder with the following command
ls command is used to list files or directories in Linux
CD use for change directory
Now, type the following command and press enter to start the Yii2 installation.
/home/master/composer global require "fxp/composer-asset-plugin:^1.3.1" composer create-project --prefer-dist yiisoft/yii2-app-basic basic
Yii2 installation will be started and you will see this screen while the installation process is going.
Once the installation is complete, go to your application tab on Cloudways, select your Yii2 application and copy the application URL link. Paste the application URL on your browser and at the end of the URL type /basic/web/ and hit enter. You will see the congratulation page of Yii as:
If you see this page, you have successfully installed Yii2 on Cloudways. If you are unable to see the Congratulations! page, you might have done something wrong during the process.
Feel free to comment below the blog and ask your query.
Customer Review at
“Cloudways hosting has one of the best customer service and hosting speed”
Sanjit C [Website Developer]
Shahzeb is a Digital Marketer with a Software Engineering background, works as a Community Manager — PHP Community at Cloudways. He is growth ambitious and aims to learn & share information about PHP & Laravel Development through practice and experimentation. He loves to travel and explore new ideas whenever he finds time. Get in touch with him at [email protected]