yiic shell works with main.php but not with index.php


I tried doing this in the main directory of my application where index.php resides.

$ path/to/yii/framework/yiic shell index.php


and it came back to prompt and the shell never opened.

but when i did this

$ path/to/yii/framework/yiic shell protected/config/main.php

Yii Interactive Tool v1.1 (based on Yii v1.1.0)

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

In general the application works fine without a flaw. and index.php is valid and its able to control the application nicely.

So, i dont quite get , it, why it worked with main.php but not with index.php.

I am using

php -v

PHP 5.3.1 with Suhosin-Patch (cli) (built: Feb 3 2010 22:58:35)

Copyright © 1997-2009 The PHP Group

Zend Engine v2.3.0, Copyright © 1998-2009 Zend Technologies



Did you try "protected/yiic shell" from the main directory of your application?

yes, i tried both

protected/yiic shell index.php


/path/to/yii/framework/yiic shell index.php

they just dont work.

it seems to like only main.php :slight_smile:

There is no error message. just the cursor returns to prompt.

is there any log that i can check ?

nothing in /var/log/messages.


What andy_s tryed to ask you is if you have tried "protected/yiic shell" - without index.php!

ok… i tried

protectec/yiic shell

and same result as before. nothing happens. no error message and i return back to the prompt.

Have you configured access rules that prevent to access the start page without login? If so, there’s no other way to use the shell except providing the path to main.php.

Hey Mike,

you hit the nail on the head.

yeah, my start page cannot be accessed unless you login.

so you when you try


it will redirect you to


no wonder :-)… thanks… you solved a big problem for me.

thanks a ton


Awesome!, I have been experiencing exactly the same behavior and until now it has totally baffled me. As a work around I created a bogus application referencing the same DB and created my models and crud and then just copied them into the appropriate places.

Thanks Mike, it’s great to know why it was broken.