Narek
Narek

Reputation: 3823

yiic.php works but not yiic in Ubuntu

I'm going to my Yii project protected folder in Ubuntu command line and types:

yiic help

it returns:

yiic: command not found

But when I type:

php yiic.php help

it works properly.

php yiic works too. Only problem when I type yiic without php. yiic file has permission 775 and php-cli installed.

What I'm doing wrong?

UPDATE

It works with:

./yiic

But I don't know what it means?

Upvotes: 3

Views: 5942

Answers (3)

Ganesan Murugesan
Ganesan Murugesan

Reputation: 145

Modify $yiic path

$yiic=dirname(__FILE__).'/../yii_framework/framework/yiic.php';

then set permission to 777 by: sudo chmod 777

Upvotes: 0

MrD
MrD

Reputation: 2481

If you are running windows, no need for any %PATH% variable, just fallow these steps:

  1. When you download the Yii from the website, there is a folder called framework inside the rar file you downloaded. Copy that folder to your webserver root directory, which is in my case C:\wamp\www.

  2. In the www folder also create a new folder called NewYiiApp. Inside this folder your new Yii application will be created and here you will write your controllers, models and classes.

  3. After that open your cmd using Start->Run->cmd.

  4. Using CMD navigate to the framework folder using cd C:/wamp/www/framework.

  5. Open Windows Explorer and naigate to the PHP directory. In my case it is located in C:\wamp\bin\php\php5.3.13

  6. Ensure that this folder contains php.exe file

  7. Paste the following line in the already opened CMD

  8. C:\wamp\bin\php\php5.3.13\php.exe yiic webapp C:/wamp/www/NewYiiApp, but change my PHP folder path with yours

  9. It will ask you: Create a web application under C:/wamp/www/NewYiiApp? Type Yes and hit ENTER.

Hope I helped!

Upvotes: 1

soju
soju

Reputation: 25312

It simply means that your project protected folder is not in your PATH environment variable.

Modify PATH

Here is a simple command to add a folder in PATH :

export PATH=$PATH:/path/to/framework

You should add yii framework folder (the real yiic command is here), not your project protected folder.

Or use a Symlink

If you don't want to modify your PATH, you could create a symlink in /usr/bin :

ln -s /path/to/framework/yiic /usr/bin/yiic 

Upvotes: 8

Related Questions