php yii serve

I’m evaluating yii and Laravel,I read some good things about yii on the web and thought I’d go through the documentation. I started going through the Installing Yii from and when I cam the the Verifying the Installation section I ran

php yii serve

and got the error : Could not open input file: yii

I then moved out of the web directory to the project root and tried again, this time I get: Error: Unknown command "serve".

I then issued a php yii which gave me a list of commands but serve is not one of them.

Is the documentation out of date, was this in version one but now removed ? or am I doing something wrong !


You merely run the command ‘yii’

On a *nix, you need to issue the command:


Running that command without arguments will give you a list of available commands. :)

EDIT: Sorry, I can’t read tonight :P

I’ve just confirmed the same problem with my Windows xampp environment.

Something is wrong with the documentation.



$ php -S localhost:8000

in your web directory.

According to the PHP documentation, the syntax for running built-in server is "php -S".


We simply write our own ‘Serve’ controller and that’s it. ;)

I have a feeling that the author of that page in the guide has that controller class present and forgot that Yii doesn’t have that built in?

It should be the command that Softark wrote.

Hi softark,

that’s what I did in the end as I use the standard php version when developing vanilla php. I wanted to check as I come from a rails background and we have a built in command which is similar to the yii serve so it made sense to me that it should work.

Shame the documentation is wrong, especially when your new to something.

Thanks for the help :)

Have to fix it ASAP

Thank you for your report.

It will be available with the next release of Yii and is already available at master.

I see.

Yii cli will support "serve" command in 2.0.7.


After installation go to “basic” directory then run command “php yii serve”.

It works for me in Ubuntu

1 Like