This website uses cookies

Our website, platform and/or any sub domains use cookies to understand how you use our services, and to improve both your experience and our marketing relevance.

📣 Try the fastest hosting platform with pay-as-you-go pricing & 24/7 expert support! MIGRATE NOW →

How to Install Yii2 Using Composer

Updated on December 10, 2021

4 Min Read
install yii2

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.

Yii Framework Usage Statistics

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.

cw platform

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:

servers

Launch SSH Terminal

Now go to the Server Management tab and click on Launch SSH terminal.

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

installation process

installation process

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.

composer

yii installation

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:

yii greetings

Related: Create A Cross-Platform REST API In Yii2

Final Words

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.

Share your opinion in the comment section. COMMENT NOW

Share This Article

Shahzeb Ahmed

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]

×

Get Our Newsletter
Be the first to get the latest updates and tutorials.

Thankyou for Subscribing Us!

×

Webinar: How to Get 100% Scores on Core Web Vitals

Join Joe Williams & Aleksandar Savkovic on 29th of March, 2021.

Do you like what you read?

Get the Latest Updates

Share Your Feedback

Please insert Content

Thank you for your feedback!

Do you like what you read?

Get the Latest Updates

Share Your Feedback

Please insert Content

Thank you for your feedback!

Want to Experience the Cloudways Platform in Its Full Glory?

Take a FREE guided tour of Cloudways and see for yourself how easily you can manage your server & apps on the leading cloud-hosting platform.

Start my tour

CYBER WEEK SAVINGS

  • 0

    Days

  • 0

    Hours

  • 0

    Mints

  • 0

    Sec

GET OFFER

For 4 Months &
40 Free Migrations

For 4 Months &
40 Free Migrations

Upgrade Now