Yiic problem in Ubuntu

Hi there! I already finished checking the requirements in yii and it was ok…

my problem is everytime i create a new application using this yiic command

bash yiic webapp demo

it gives me this error

yiic: line 2: ?php: No such file or directory

yiic: line 3: /bin: is a directory

yiic: line 4: base: command not found

yiic: line 5: base: command not found

yiic: line 6: base: command not found

yiic: line 7: base: command not found

yiic: line 8: syntax error near unexpected token `newline’

yiic: line 8: ` * @author Qiang Xue <qiang.xue@gmail.com>’

im a newbie in yiic and any help would be appreciated. Also I’m using Ubuntu 10.04, Mysql, Php 5 and Apache 2

Why did you add bash before your command?

I think you should type this :

./yiic webapp demo

im inside the framework folder and i typed that command… still it gives me an error message.

yiic: command not found

hi there!!

think you need to use this instead to install skeleton blog

first you need to get into your webroot by

cd /var/www <-- in my case

create a folder that you want your demo to be install in my case I create a folder named ‘blog’ under /var/www/yii/

then set permission to 777 by: sudo chmod 777

then type in the following command

php yii/framework/yiic.php webapp /var/www/yii/blog

if your php program has not been installed, the system will give you an install command then do it and come back to do the same.

then you can access your demo by http://localhost/yii/blog <— in my case

buknoii, did you solve your problem?

There’s no response from the topic creator whether the problem has been solved or not…

Anyway, for the sake of Ubuntu users and wanted to try Yii as their framework, here’s what I’ve done:

  1. Extract your downloaded Yii pack to a web-accessible folder, let’s say the folder’s name YiiFramework.

  2. Open your command line, and go to your web server’s document root, say MyWebroot.

$ cd MyWebroot

  1. To create your demo folder, type in your command line:

$ YiiFramework/framework/yiic webapp demo

  1. It will ask a confirmation from you if you really want to create a web application under /MyWebroot/demo, so just type in there Yes and hit enter. It will create all the default files and folders for the framework’s web application skeleton .

  2. Go to http://localhost/demo/index.php to verify if the web application has been created.


  • bash and ./ wont work because yiic is not an ubuntu or even a linux command. As a matter of fact, I was able to run yiic in the command prompt of windows 7! ;)

  • I extracted Yii right in my apache’s documentroot. If you placed it (extracted Yii files) inside a folder under your documentroot, you need to change the directory in step #3 to access yiic

  • There might be a need to change the yiic file’s permission for it to become executable (like chmod +x) if permission denied error appears when executing step #3.

  • If ever you encounter the error "/usr/bin/env: php: No such file or directory", just install php5-cli

sudo apt-get install php5-cli

Try pre creating the site directory.

I had the same problem with Ubuntu 10.10 until I created the directory manually. Since my webroot is /var/www:

mkdir /var/www/someYiiProj

./yiic webapp someYiiProj

worked fine

when I tried to run from the command line php -v , it said php was not installed.

I discovered my version of Ubunut (karmic) did not have the php cli installed, webpage processing worked fine, but php5 from the command line interface did not work. so I had to sudo apt-get install php5-cli

that also failed, so I had to type sudo apt-get update to update all the apt locations, and then run the install of php5 cli

then I was able to run the command line magic to create the testdrive !

This worked for me. Thanks :)

Nothing but errors here. It also seems everybody posting as a different solution which is never a good thing.

Error: The directory ‘var/www/Industry_Assignment’ is not valid. Please make sure the parent directory exists.


yiic webapp <app-path>


This command generates an Yii Web Application at the specified location.


  • app-path: required, the directory where the new application will be created.

    If the directory does not exist, it will be created. After the application

    is created, please make sure the directory can be accessed by Web users.

My command was: /var/www/YII/framework$ php yiic webapp var/www/Industry_Assignment


I have a LAMP environment on Ubuntu and a VirtualBox running XP with an XAMPP dev environment so I set up the environment variables on XP and YII setup runs like a charm

I think it is a matter of setting the environment variables for PHP and YII on Ubuntu to solve this issue.

Prepend the directory with a slash. :)

It’s ‘/var’ not ‘var’ …

does anybody know how to set the path for php and yii on ubuntu?


What do you mean the path for PHP and path for Yii?

If you want to find out where php5-cli is installed, you can try:

which php

It will output something like /usr/bin/php.

I don’t know what you mean by path for Yii. Maybe path to yiic, which is the place you unpacked the YiiFramework archive. If you have your copy of YiiFramework in ~/yii/ then yiic will be in ~/yii/framework/yiic.

The yiic file is just a bash script that runs yiic.php using PHP. If you open it in a text editor, you can see:

#!/usr/bin/env php



So, running ./yiic or php yiic.php is exactly the same thing.

@gareth: use your editor to open .bashrc in your /home/<user> folder and put the path to the framework in the end of the file. For example, in my case


export PATH

After that, you can use yiic command line from the terminal

There is just one caveat:

You need to use ./yiic instead of just yiic if you intend to run the application specific yiic script.

Otherwise it will run the framework yiic script instead. :)


Please, explain me why ./yiic works perfectly but yiic gives me

yiic: command not found

I added in the end of ~/.bashrc that lines:


export PATH

but still yiic doesn’t work. I use Ubuntu 12.04



Have you tried to add this to /home/zablik/.profile ?

I have some thing similar setup on ubuntu 11.10 which works very well via yiic

use this and you will able to access it from anywhere

$ sudo ln -s /path/to/your/yiic /usr/local/bin

This work for me!!!

BUT, can you explain why?