Yii Framework Forum: Basic Install Yii - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Basic Install Yii Installation Yii

#1 User is offline   Ankit Modi 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 908
  • Joined: 19-February 13
  • Location:India

  Posted 05 June 2013 - 08:14 AM

Hi Friends,

some common question How to Install yii so in this topic you can basic install of yii

Basic Install yii
1. Download yii folder

2. Go to var/www directory in terminal
3. TO create a new project follow:

first you need to get into your webroot by

cd /var/www <– in my case

create a folder that you want your demo to be install in my case I create a folder named ‘blog’ under /var/www/yii/

then set permission to 777 by: sudo chmod 777

then type in the following command

php yii/framework/yiic.php webapp /var/www/yii/blog

if your php program has not been installed, the system will give you an install command then do it and come back to do the same.

then you can access your demo by http://localhost/yii/blog <— in my case

4. To enable gii
go to protected>config>main.php and uncomment gii module

5. To access gii generator go to http://localhost/myproj/demo/index.php?r=gii/default/login

6. To convert url mapping into path format go to config>main.php and uncomment

7. Passing variable data from controller to view

In Controller
public $message = ‘Hello World rom controller’;
public function actionIndex()
Now variable content is available to modified

In View

Alternatively we could do
message   ?>
8. CRUD generation
a) Config database
B) Go to protected>>config>>main.php
c) Uncomment db componenent
d) Give the username , password, and db name
e) Comment out sqlite configuration which lie just above the mysql configuration

9. GO to gii

10. Select model generator

11. Enter table details and generate the model

12. We now have Message.php under model directory

13. Now click on CRUD generator

14. Enter Model name
15. Click generate
16. You can try it out by goign to baseurl/modelname
17. Access database content via these codes in controller
    public $message = ”;
   public function actionIndex()

Hope it helpful

Best Regards,
Ankit Modi
Ankit Modi
Skype : amodi06

#2 User is offline   mirunho 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 170
  • Joined: 19-December 12
  • Location:Gdansk, Poland

Posted 05 June 2013 - 08:46 AM


#3 User is offline   softark 

  • Keep It Simple
  • Yii
  • Group: Moderators
  • Posts: 3,630
  • Joined: 16-February 11
  • Location:Japan

Posted 05 June 2013 - 09:06 AM

/* Moved from "General Discussion for Yii 1.1.x" to "Tips, Snippets and Tutorials" */

Share this topic:

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users