Yii 1.1: To configure Yii path in Windows platform

4 followers

I can see many questions regarding configuring the path using Windows OS. I could hardly get the right information about it. The cook book has defined for Linux. So I would like to share my idea on it. To configure the Yii path using Windows OS,

  1. Open command prompt.
  2. Type the following command:

E:\xampp\php>php.exe E:/xampp/htdocs/yii/framework/yiic webapp E:/xampp/htdocs/blog

  1. Promptly you will get an notification: Create a Web application under 'E:\xampp\htdocs\blog'? [Yes|No]
  2. Press Y
  3. Related directories,subdirectories and files will be created
E:\xampp\php>php.exe E:/xampp/htdocs/yii/framework/yiic webapp E:/xampp/htdocs/blog
Create a Web application under 'E:\xampp\htdocs\blog'? [Yes|No] y
      mkdir E:/xampp/htdocs/blog
   generate index-test.php
   generate index.php
      mkdir E:/xampp/htdocs/blog/themes
      mkdir E:/xampp/htdocs/blog/themes/classic
      mkdir E:/xampp/htdocs/blog/themes/classic/views
   generate themes/classic/views/.htaccess
      mkdir E:/xampp/htdocs/blog/themes/classic/views/system
      mkdir E:/xampp/htdocs/blog/themes/classic/views/site
      mkdir E:/xampp/htdocs/blog/themes/classic/views/layouts
      mkdir E:/xampp/htdocs/blog/protected
   generate protected/.htaccess
   generate protected/yiic
   generate protected/yiic.bat
   generate protected/yiic.php
      mkdir E:/xampp/htdocs/blog/protected/views
      mkdir E:/xampp/htdocs/blog/protected/views/site
   generate protected/views/site/contact.php
   generate protected/views/site/error.php
   generate protected/views/site/index.php
   generate protected/views/site/login.php
      mkdir E:/xampp/htdocs/blog/protected/views/site/pages
   generate protected/views/site/pages/about.php
      mkdir E:/xampp/htdocs/blog/protected/views/layouts
   generate protected/views/layouts/column1.php
   generate protected/views/layouts/column2.php
   generate protected/views/layouts/main.php
      mkdir E:/xampp/htdocs/blog/protected/tests
   generate protected/tests/bootstrap.php
   generate protected/tests/phpunit.xml
   generate protected/tests/WebTestCase.php
      mkdir E:/xampp/htdocs/blog/protected/tests/unit
      mkdir E:/xampp/htdocs/blog/protected/tests/report
      mkdir E:/xampp/htdocs/blog/protected/tests/functional
   generate protected/tests/functional/SiteTest.php
      mkdir E:/xampp/htdocs/blog/protected/tests/fixtures
      mkdir E:/xampp/htdocs/blog/protected/runtime
      mkdir E:/xampp/htdocs/blog/protected/models
   generate protected/models/ContactForm.php
   generate protected/models/LoginForm.php
      mkdir E:/xampp/htdocs/blog/protected/messages
      mkdir E:/xampp/htdocs/blog/protected/extensions
      mkdir E:/xampp/htdocs/blog/protected/data
   generate protected/data/schema.mysql.sql
   generate protected/data/schema.sqlite.sql
   generate protected/data/testdrive.db
      mkdir E:/xampp/htdocs/blog/protected/controllers
   generate protected/controllers/SiteController.php
      mkdir E:/xampp/htdocs/blog/protected/config
   generate protected/config/console.php
   generate protected/config/main.php
   generate protected/config/test.php
      mkdir E:/xampp/htdocs/blog/protected/components
   generate protected/components/Controller.php
   generate protected/components/UserIdentity.php
      mkdir E:/xampp/htdocs/blog/protected/commands
      mkdir E:/xampp/htdocs/blog/protected/commands/shell
      mkdir E:/xampp/htdocs/blog/images
      mkdir E:/xampp/htdocs/blog/css
   generate css/bg.gif
   generate css/form.css
   generate css/ie.css
   generate css/main.css
   generate css/print.css
   generate css/screen.css
      mkdir E:/xampp/htdocs/blog/assets
 
Your application has been created successfully under E:\xampp\htdocs\blog.
 
E:\xampp\php>

Now you can access yii framework. :)

Total 2 comments

#10830 report it
mrs at 2012/11/26 01:05pm
May be following link help you a lot

Hi,

I think you can have a look on following link- Install and configure Yii, an easy way

With Thanks,

mrs

#4155 report it
yeepyeep at 2011/06/09 08:17pm
i'm a newbie so...

Please correct me if I'm wrong! The problem I see with the above configuration is that you have left the core framework files accessible under the webRoot and could be accessed by a user if this were the setup used in a production environment.

In my development environment, for example, I place all my versions of the yii framework under c:\yii\yii-version number.
NB// The reason I have different versions to use is so I can try different tutorials using the same yii version as the tutorial.

My webRoot directory, using WAMP, is C:\wamp\www\

I only use one version of PHP so I have added it's location to my path variable (right click My Computer > environment variables > path > add location to php.exe). This makes accessing it from the command line a little easier, that's all.

So, when it comes to setting up a webApp using yiic, I would use the following:

  1. Open the command prompt: Run>cmd.exe

  2. Change the directory to point to the framework folder in the version of yii that you are using so you can access the yiic.bat file

  3. c:> cd path\to\yiic or in my setup I would type cd c:\yii\yii-1.1.7.r3135\framework resulting in: c:\yii\yii-1.1.7.r3135\framework>

  4. Now. at this prompt, I would type yiic webapp c:\wamp\www\example This would create a new webApp called 'Example' under my webRoot directory.

You can easily change where your webApp looks for base yii.php by opening and editing the first couple of lines inthe applications entry script index.php located in this example at c:\wamp\www\example\index.php.

$yii=dirname(__FILE__).'/../../../yii/yii-1.1.7.r3135/framework/yii.php';
 
$config=dirname(__FILE__).'/protected/config/main.php';

I am also in the habit of moving my config/main.php file outside of the webRoot directory and updating its new location in the index.php file as per the above.

Leave a comment

Please to leave your comment.

Write new article