Thursday, January 30, 2014

Web 2 development with Yii (Implementation and configuration)

Instagram
 

Yii.....High performance PHP framework that can use to create web applications easily. 

This topic will discuss how to install(implement) and configure Yii to use it more efficient way...
[As I'm an Ubuntu user I ll explain things only from linux ;) ]

I mentioned that this is an PHP based framework so again don't want to say, you must have PHP in your PC/Server to continue......  :P

Download yii latest version and extract it in to a folder where you wish. 
[In my case its in /opt/lib/php/yii..... Most people extract this in their web root but I m not recommend it.]

In this yii folder you can see another two folders named "framework" & "requirement"....
[Better if you can create a simlink in your webroot to this requirement folder and load it in browser for make sure you got what you want.]

Anyhow now goes the making life easier part... ;)

First need to change php.ini file to include things in /opt/lib/php folder (as all my php including stuffs contain in that location) when loading httpd.

For that search key word "include_path" in php.ini and change its value as follow..
       include_path = ".:/opt/lib/php"

Then we ll make yiic command to available in anywhere in your PC/Server. For that better if you execute command in your shell "which php" and get the path of where your executables are..[in my case /usr/bin/php]

Then create a simlink to yiic file in yii framework folder
       ln -s /opt/lib/php/yii/framework/yiic /usr/bin/yiic

Or you can skip above step by adding this to your PATH variable in .bashrc ...
(.bashrc file located in your home folder)

# set yiic command to $PATH
export YII=/opt/lib/php/yii/framework/yiic
export PATH=$PATH:$YII

Done...Now restart the httpd and execute yiic in shell.

Any of above steps not must for implement Yii.. That's why I mentioned making life easier

After completing whole these procedure cd to your webroot from shell and execute...
       yiic webapp your-web-app

This will create a web application named your-web-app...




Happy Hacking..... ;)

No comments:

Post a Comment