Velvet Star Monitor

Standout celebrity highlights with iconic style.

general

Could not open input file: yii

Writer Matthew Barrera

I'm working with Yii2 and trying to init some migration files. This was working a few months ago, now I'm getting the following error

'yii' is not recognized as an internal or external command
command I'm trying to run is 'yii migrate/create init_my_table

I've been looking around but not exactly sure what the problem is.

Seems like this should be a pretty generic and easy to fix error...

3 Answers

Before i delve into proposing a solution, check if you installed Yii's Basic Template or the Advanced Template.

$ php yii serve

will work for the "basic" template.

Make sure at the Terminal, you have changed to the "basic" directory, then enter the command:

 $ php yii serve

OUTPUT

Server started on
Document root is "PATH/public_html/yiiproject/basic/web"
Quit the server with CTRL-C or COMMAND-C.

IF you are using the Advanced Template, read this thread and see if the Thread here helps. Read it till the very end:

Had this same issue but was using the Advanced template.

php yii serve Could not open input file: yii

i tried this command as recommended. It worked:

 $ php -S localhost:8000

Hope this helps.

UPDATE FOR ADVANCED TEMPLATE

After installing Composer and Yii, open your Advanced template folder in CLI and run this command:

 $ php ./init

This initialization process will setup the project and create necessary files.

Set your document root properly in apache to your /advanced/web/

More Reading to run your project:

Make you that your Environment Variables are set up correctly.

Check out these links:

Similar question

Environment Variables

Relevant parts from links:

To access the environment variables right click the My Computer icon then choose properties. Select the Advanced tab and then click Environment Variables.

window you should see

path :=>...;D:\YOURPATH\xampp\php;D:\YOURPATH\xampp\yii\yiiframework;

1

Try installing composer globally. I had similar issue but it was resolved after I installed composer via installation file and using my environment variables, I made available globally.

1

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy