Problems with yiic -- Windows

First off I would like to say I like this project a lot so far and I think it will help me tremendous in my current project. However I am having a problem with the command line tool. I first started trying to run the back fine in the folder

D:\xampp\htdocs\yii\framework

I kept getting the error:

D:\xampp\htdocs\yii\framework>yiic

‘php.exe’ is not recognized as an internal or external command,

operable program or batch file.

So I opened the batch file and updated it to the exact location of my php.exe file:

@setlocal

set YII_PATH=%~dp0

if "%PHP_COMMAND%" == "" set PHP_COMMAND=D:\xampp\php\php.exe

%PHP_COMMAND% "%YII_PATH%yiic" %*

@endlocal

Then I was able to run the command:

yiic webapp D:\xampp\htdocs\ats

This generated the application framework happy and good so far.

Now I am trying to generate the models and I am running into a issue that will give me no error. It just stops.

Microsoft Windows [Version 5.2.3790]

© Copyright 1985-2003 Microsoft Corp.

D:\xampp\htdocs\ats\protected>yiic shell

Error: index.php does not exist or is not an entry script file.

USAGE

yiic shell [entry-script | config-file]

DESCRIPTION

This command allows you to interact with a Web application

on the command line. It provides tools to automatically

generate new controllers, views and data models.

It is recommended that you execute this command under

the directory that contains the entry script file of

the Web application.

PARAMETERS

  • entry-script | config-file: optional, the path to

    the entry script file or the configuration file for

    the Web application. If not given, it is assumed to be

    the ‘index.php’ file under the current directory.

D:\xampp\htdocs\ats\protected>yiic shell D:\xampp\htdocs\ats\index.php

Yii Interactive Tool v1.0 (based on Yii v1.0.11-dev)

Please type ‘help’ for help. Type ‘exit’ to quit.

>> model User

D:\xampp\htdocs\ats\protected>

Please help me :unsure:

You can try to set PATH variable to C:\xampp\htdocs\yii\framework (for the future)

then go to command line tool and try this:

cmd

cd\

cd C:\xampp\htdocs\ats

yiic shell index.php

I think the problem is you didn’t specify your index.php as entry script. You called:


D:\xampp\htdocs\ats\protected>yiic shell

You should call something like:


D:\xampp\htdocs\ats\protected>yiic shell ../index.php

It’s because it can’t find php.exe, add

D:\xampp\php

to the PATH environment var or use the absolute path.

I always stick with working with the single shell script (so I dont need to modify multiple) within /yii/framework/




CMD


CD C:\xampp\htdocs\yii\


framework\yiic shell c:\xampp\htdocs\ats\index.php




it will be good for the next projecst in the future if you set Path variable for PHP and YII:

C:\xampp\php;

C:\xampp\htdocs\yii\framework;

then go to command line tool and try this:

cmd

cd\

cd C:\xampp\htdocs\ats

yiic shell index.php -> important thing here is index.php file

Agreed!

Thanks, this helped get started on Windows 7. This should be a sticky post and referenced from http://www.yiiframework.com/doc/guide/1.1/en/quickstart.installation for us Windows users.