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 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 hosting paradise for agencies, bloggers, website owners and for those who are looking for reliable and speedier load times on their websites.
Before you get started, signup or login to Cloudways platform.
To host your Yii application on Cloudways, follow the below given steps:
- Launch your server
- Select your application
- Choose your desired cloud provider and server size
- Select your data center
- Launch Server
- Launch SSH Terminal
- 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 and others.
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
To 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
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 as:
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 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 firstname.lastname@example.org
Launch PHP websites without the worry of Server Management.
Pre-Installed Optimized Stack with Git, Composer & SSH