Social Icons

Thursday, May 30, 2013

Installing and Setup Yii framework - PHP

Yii framework is one of the popular PHP MVC framework these days. Here, I am providing a guide to install yii framework. Just make sure your web server is capable of supporting PHP 5.1 orr higher. I assume that you have already installed web server and PHP or softwares like wamp, xampp or lamp. So, here we go.

First, download the yii framework from http://www.yiiframework.com/download/ . Unpack the downloaded file to a web accessible folder. For example, if you have xampp installed then place it inside xampp/htdocs/ , if wamp then you can place it in wamp/www/ . Now, you can check if your server satisfies all requirements for using yii and the installation was a success. I assume you have installed xampp server and put the downloaded yii folder inside xampp/htdocs/ . Now, open the url in your browser as http://localhost/yii/requirements/index.php You will see the results there. Few fields may show warnings like for PDOSQLite extension or memcache extension. But that is ok. You can proceed. Now, lets talk about creating a new application in yii.

Creating a new application in yii

We will use a command line tool 'yiic' that comes packaged with he yii framework. It is not mandatory to use this toll but it saves time and helps in creating a new yii application easily. Now, open your command terminal and change to your webroot folder i.e, till xampp/htdocs.

cd xampp/htdocs

If you have installed wamp then you have to reach to wamp/www. Here, I assumed you have xampp installed.

Now, as you put yii downloaded folder inside htdocs as xampp/htdocs/yii, run the command like this...

yii/framework/yiic webapp demo

Here, 'demo' is your project folder name.

Note: If you get the error here as : php.exe is not recognized as an internal or external command then look here for the solution: http://awesomesirjee.blogspot.in/2013/05/phpexe-is-not-recognized-as-internal-or.html

On running the above command, it will give you message as :

Create a Web application under '/xampp/htdocs/demo'? [Yes|No]
Yes

It will create you application successfully. You can check a new folder named 'demo' is there in xampp/htdocs/ . You see how easily you created a new brand yii application with just one command. Now, got your browser and type in url: http://localhost/demo/index.php

You will find your new application running with a welcome page. Thats it.

No comments:

Post a Comment

Total Pageviews