17 December 2010

How to install and set up Yii framework application to your hosting.

Get and Upload Yii Framework:


Get a stable version of Yii.

Upload LICENCE, framework and requirements.

Test if Your Hosting Meets the Requirements:


http://example.com/requirements/index.php

If you pass then you may remove requirements directory, but when you switch hosting then you might need it again.

Create a Skeleton for Your Application:


Yii comes with a command line tool called "yiic" that can create a skeleton Yii application for you to start with.

On command line, type in the following commands:
Windows(You need PHP CLI):
Source code viewer
  1. cd YiiPath\framework
  2. yiic webapp ..\app-name
Programming Language: Bash

Linux:
Source code viewer
  1. sudo apt-get install php5-cli
  2. cd YiiPath/framework
  3. ./yiic webapp ../app-name
Programming Language: Bash


You can access it from the following URL: http://example.com/app-name
Now that yii framework is set up, you can find some fine tutorials from Yii websites resources page.

Database:

Connecting to database is optional, but most web applications use it so I will show how to do it. Open /app-name/protected/main.php file. There is an array, where all the configuration is written. You can easily find the database data.