Yii Framework Forum: Yiic problem in Ubuntu - Yii Framework Forum

Jump to content

  • (2 Pages)
  • +
  • 1
  • 2
  • You cannot start a new topic
  • You cannot reply to this topic

Yiic problem in Ubuntu Rate Topic: -----

#1 User is offline   buknoii 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 2
  • Joined: 28-September 10

Posted 28 September 2010 - 10:56 PM

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
0

#2 User is offline   Mike 

  • Elite Member
  • PipPipPipPipPip
  • Yii
  • Group: Members
  • Posts: 3,013
  • Joined: 06-October 08
  • Location:Upper Palatinate

Posted 29 September 2010 - 01:34 AM

Why did you add bash before your command?
0

#3 User is offline   junxiong 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 541
  • Joined: 21-June 10

Posted 29 September 2010 - 05:58 AM

I think you should type this :
./yiic webapp demo

“The most likely way for the world to be destroyed, most experts argue, is by accident. That’s where we come in; we’re computer professionals. We cause accidents.” - Nathaniel Borenstein

Yii Playground : Collaborative demo apps. You can join to improve it too!
My Team's Blog: In Indonesian.
0

#4 User is offline   buknoii 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 2
  • Joined: 28-September 10

Posted 29 September 2010 - 09:28 AM

View Postjunxiong, on 29 September 2010 - 05:58 AM, said:

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
0

#5 User is offline   nerddev 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 1
  • Joined: 29-September 10

Posted 29 September 2010 - 11:46 PM

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
1

#6 User is offline   xdolving 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 6
  • Joined: 01-October 10

Posted 21 October 2010 - 04:53 AM

buknoii, did you solve your problem?
0

#7 User is offline   macinville 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 268
  • Joined: 25-October 10
  • Location:Marikina City, Philippines

Posted 26 October 2010 - 10:57 PM

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


3) To create your demo folder, type in your command line:
$ YiiFramework/framework/yiic webapp demo



4) 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 .

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

Notes:
* 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

Tell your tail.
Don't be shy to upvote a post if it was able to help you
1

#8 User is offline   snapCrackerJoe 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 5
  • Joined: 19-December 10
  • Location:United States

Posted 29 December 2010 - 08:20 AM

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
0

#9 User is offline   SteveWa 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 6
  • Joined: 14-January 11

Posted 14 January 2011 - 01:55 PM

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 !
0

#10 User is offline   trockey 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 7
  • Joined: 17-March 11

Posted 17 March 2011 - 04:56 PM

View PostSteveWa, on 14 January 2011 - 01:55 PM, said:

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 :)
0

#11 User is offline   gareth 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 6
  • Joined: 04-December 11

Posted 04 December 2011 - 01:32 AM

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.

USAGE
yiic webapp <app-path>

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

PARAMETERS
* 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

Update:

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.

This post has been edited by gareth: 04 December 2011 - 02:15 AM

0

#12 User is offline   jacmoe 

  • Elite Member
  • Yii
  • Group: Moderators
  • Posts: 2,601
  • Joined: 10-October 10
  • Location:Denmark

Posted 04 December 2011 - 03:56 AM

Prepend the directory with a slash. :)

It's '/var' not 'var' ...
"Less noise - more signal"
0

#13 User is offline   gareth 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 6
  • Joined: 04-December 11

Posted 04 December 2011 - 07:26 PM

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

thanks
0

#14 User is offline   Vlad V 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 12
  • Joined: 15-August 10
  • Location:România

Posted 08 December 2011 - 09:55 AM

View Postgareth, on 04 December 2011 - 07:26 PM, said:

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

thanks


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
<?php

require_once(dirname(__FILE__).'/yiic.php');

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

#15 User is offline   bubuzzz 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 1
  • Joined: 10-December 11

Posted 10 December 2011 - 09:52 AM

@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

PATH=$PATH:/var/www/cakephp1.3/cake/console:/var/lib/gems/1.8/gems/rails-3.0.10/bin:/var/www/yii/framework
export PATH


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

#16 User is offline   jacmoe 

  • Elite Member
  • Yii
  • Group: Moderators
  • Posts: 2,601
  • Joined: 10-October 10
  • Location:Denmark

Posted 10 December 2011 - 10:07 AM

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. :)
"Less noise - more signal"
0

#17 User is offline   zablik 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 1
  • Joined: 01-August 12

Posted 01 August 2012 - 12:30 PM

Hi
Please, explain me why ./yiic works perfectly but yiic gives me
yiic: command not found

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

PATH=$PATH:/home/zablik/server/frameworks/yii/framework
export PATH

but still yiic doesn't work. I use Ubuntu 12.04
Thanx.
0

#18 User is offline   Seal 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 126
  • Joined: 02-February 10

Posted 01 August 2012 - 07:52 PM

@zablik,

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
Sylvester La-Tunje

Posted Image
0

#19 User is offline   alirz23 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 841
  • Joined: 08-August 12
  • Location:Durban, South Africa

Posted 08 August 2012 - 09:25 AM

use this and you will able to access it from anywhere

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

#20 User is offline   Jing Guo 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 6
  • Joined: 25-August 12

Posted 25 November 2012 - 11:07 PM

View Postjacmoe, on 10 December 2011 - 10:07 AM, said:

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. :)


This work for me!!!

BUT, can you explain why?

Thanks!
0

Share this topic:


  • (2 Pages)
  • +
  • 1
  • 2
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users