[SOLVED] Running yiic from the command prompt with EasyPHP

[Total: 0   Average: 0/5]

I am currently experimenting with the Yii framework and I had some troubles running the yiic utility from Windows command prompt using the EasyPHP WAMP stack (I normally work on a Mac, but I wanted to make it work on Windows too).

While the stack works fine from a web browser, invoking PHP from its home directory under EasyPHP would raise a lot of warnings, mostly complaining about missing DLL extensions. Really annoying! It turns out php.exe cannot find its configuration file php.ini. Off to fix it.

1) There is a php.ini file in the php directory under EasyPHP installation directory, but this is not the right one. You need to use the one under EasyPHP\apache instead. Rename the old one to something meaningful (just in case) and copy php.ini from EasyPHP\apache into EasyPHP\php\php546x120925133033 where php546x120925133033 is the directory under EasyPHP\php where php.exe can be found. Yours could be different, depending on your EasyPHP installation, and you need to use yours throughout the following steps.

2) When using yiic to generate a new web application, it typically needs to be launched from the web server root folder. yiic.bat is normally located into .\yii\framework respect to the web server root folder and we need access to php.exe to make it run. Normally php.exe is not in the system PATH, so we need a way to access it.

The easiest solution I found is to edit yiic.bat to make sure it can find php.exe. Here is what the edited yiic.bat should look like:

Note that these 2 lines were modified to include php.exe into the system PATH (so it can be found) and to correctly reference the YII installation and the php.exe location.

set YII_PATH=C:\Program Files\Apps\EasyPHP-12.1\www\yii\framework\

if “%PHP_COMMAND%” == “” set PHP_COMMAND=C:\Program Files\Apps\EasyPHP-12.1\php\php546x120925133033\php.exe

Obviously you need to adapt your paths according to your EasyPHP and Yii installation. In my case EasyPHP was installed in C:\Program Files\Apps\EasyPHP-12.1, with the web root called www. Yii was installed in yii inside EasyPHP the web root.

Once you are done with these settings, you can open a command prompt, navigate to EasyPHP web root (www in my case) and use yiic with the following syntax (which will generate a new web application named myapp):

If you want to invoke yiic.php directly through php.exe, you can think of adding the path to php.exe to the system PATH:

3) When invoking php.exe, you can still receive one warning regarding php_yaz.dll not having been found.
This is most probably due to some incompatibility between your version of PHP and the version of this extension. This fix the issue, edit your php.ini file inside EasyPHP\php\php546x120925133033 and comment out the line that says:

Enjoy your web development with Yii! 🙂

You may also like


  1. Thanks It  worked for me too.We need to set correct paths in yiic bat file in order to it work

    Thanks again

  2. Thank you very much, this is the best explanation I found on the web 🙂 I waste 3 hours of my time to solve problem, with your explanation I lose 5 minutes

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.