How to Host Yii on Cloudways using SSH

by Ahmed Khan  December 22, 2015

If you are looking to develop large-scale web applications, then Yii, an object oriented based PHP framework, is definitely for you. Yii enables reusability in Web programming and significantly speeds up your application development process.

how to install yii

Talking about speed, Cloudways provides a fast-track deployment of PHP stack which enables you to install any PHP based framework with ease and in just a few minutes. With the increasing demand of Yii, I thought it would be great to share with our users, experts and beginners alike, as to how easily they can install any version of Yii on Cloudways platform through the SSH terminal.

Before you get started, here is what you need:
– Cloudways Account (Sign up using the XMAS30 promo code during your signup, upgrade your account and receive up to 2 Months of Free Hosting this Christmas!)
– Yii Framework from GitHub

Related: How To Host Yii 2 Framework On Cloudways Using Composer

Let’s get started:

Step 1: After Sign Up, choose your desired Cloud provider

Cloud Providers

Step 2: Launch a PHP Stack

Now launch a PHP Stack.

Select Application

 

After this, choose a desired server size and location. Now click on Launch and wait for the server to launch.

When your server starts, you need to launch your SSH Terminal.

Step 3: Launch your SSH Terminal

Now navigate to the Server Management tab and under Master Credentials launch the SSH terminal.

Cloudways Console

Step 4: Install Yii Using wget Command

Go to your SSH terminal and type the following commands which will take you to the root folder, where you will download Yii.

 

Type ls and copy the name of the newly created folder then paste the following command from the browser.

 

Now that you are in your root folder, go to the official Yii page on github. Right click on the Download Zip button and click copy link address. type wget and paste the link that you have copied.

This will download the zip file content of Yii on your server.

Yii Installation

Step 5: Unzip the Folder

After the file is downloaded, you need to unzip it by typing

Now type ls -al to view the files. You will see that the folder name for Yii’s content is quite large. So let’s rename it for our own ease. Type the following command.

Now you need to remove the index.php and develop.zip file from your root folder by typing this command:

Step 6: Run New app in Yii

We are almost set. Let’s start a test drive application of Yii by typing this command

When you press Enter, it will ask if you want to create the application. Type Yes and hit Enter.

Step 7: Run it

Now go to the application management tab and copy the application URL. Paste the URL in a new tab and type /testdrive at the end. If you see this error page:

yii installation

Then you need to connect to your ftp server using filezilla or other software. Enter your ftp info which can be found from Server Management under Master Credentials tab.

Now go to your test drive folder which is under public_html and open index.php in editor. Then, at the top type this

Now save it. Upload it again and run your site. You should see this page:

Yii Installation

If you are seeing this page then your Yii has been successfully configured. Now you can add your domain into application and start using Yii on Cloudways with increased performance and speed. Cloudways makes your PHP websites load faster than usual and helps developers develop large-scale web applications with ease and relaxability. Developers don’t need to fret over how their PHP based application is going to perform when hosted on Cloudways.

Create PHP websites without the worry of server management.

Deploy your PHP app on optimized PHP hosting servers.

About 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

Stay Connected:

You Might Also Like...

  • Hi! I just want to ask if this is applicable in Yii2? I’m assuming, you’re tutorial is Yii1

    • Ahmed Khan

      I think there should be no problem. However, I will write another article after trying Yii 2 on Cloudways Platform. Thanks for visiting, though! 🙂

      • Thank you, will wait for that.

        • Hey, I have written the article: http://www.cloudways.com/blog/install-yii-2-framework-on-cloud/

          Do let me know if it solves your problem. 🙂

          • Thank you, but how to get rid the “web” on the url? I did try moving the other folders one step up to private_html but still can’t sort this out.

          • You need to do 2 things

            1.) Move the all content of basic to public_html
            2) Then you need to move all the content inside web to public_html
            3) now open index.php in an editor and change the require directory path of from /…/vendor to /vender and /../config to /config. and remain the path after this unchanged and every thing is done.