X
    Categories: Learn PHP Tutorials, Tips And GuidesYii Tutorials, Tips And Guides for beginners

How to Host Yii 2 Framework on Cloudways Using Composer

A lot of readers came in and asked the procedure for hosting Yii2 on Cloudways platform. Hence, I am sharing the step by step guide on how you can use the composer to host Yii2 framework on the Cloudways platform.

What is Yii2?

Yii2 is the latest version of Yii framework and is basically a rewrite of Yii on top of PHP 5.4.0. It is aimed to become a hot favorite of the new generation of PHP frameworks. Now let’s get started:

For installing Yii2 on Cloudways, 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 hosting paradise for agencies, bloggers, website owners and those looking for reliable and speedier load times on their websites.

Before you get started, here is what you need:
– Cloudways Account (Sign up using the SUMMER43 promo code during your signup, upgrade your account and receive 15% discount for up to 3 Months onHosting this Summer!)

To host your Yii application on Cloudways following steps will be followed.

  1. Launch your server
  2. Select your application
  3. Choose your desired cloud provider and server size
  4. Select your data center
  5. Launch Server
  6. Launch SSH Terminal
  7. Install Yii2 on Hosting

Let’s get started:

Step 1: Launch Your Server

Login to your Cloudways account, And Click on Launch server.

Step 2: Select your Application

Now that you are on Launch Server page. Select your application as PHP Stack. Fill in your application name, Server name and project name.

Step 3: Choose your desired Cloud provider and Server Size

Now choose your cloud provider. Cloudways offers cloud servers from ( Google, Amazon, Digital Ocean, Vultr, Kyup)

Step 4: Select your Data Center

Now select your data center which is closest to your location.

Step 5: Launch Server

Now click on launch button and your server will be ready within 8 minutes. Once your server is created you will be able to see the following page.

 

Step 6: Launch SSH Terminal

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

Login in your terminal with the username and password provided in Master Credentials.

Step 7: Install Yii2 on Hosting

In order install Yii2, type the following commands in order to go to our newly created PHP Stack Yii2 folder.

cd applications
cd yii2

Since now we are in our application folder we have to go to public_html where we will install Yii2

cd public_html

Now, type the following command and press enter to start Yii2 installation

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 and select your Yii2 application and copy the application URL link. Paste the application URL on your browser and at the end of URL type /basic/web/ and hit enter. You will see the congratulation page of Yii

Related: Create A Cross-Platform REST API In Yii2

If you see this page, you have successfully hosted Yii2 on Cloudways. If you are unable to see the Congratulations! page, you might have done something wrong during the process. Not to worry, you can contact me with your error and I will try my best to resolve your problem. Feel free to comment below the blog and ask your query.

Ahmed Khan: Ahmed was a PHP community expert at Cloudways - A Managed PHP Hosting Cloud Platform. He is a software engineer with extensive knowledge in PHP and SEO. He loves watching Game of Thrones is his free time. Follow Ahmed on Twitter to stay updated with his works. You can email him at ahmed.khan@cloudways.com