Yii Framework Forum: please help chapter 8 - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

please help chapter 8

#1 User is offline   tanja 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 2
  • Joined: 31-May 11

Posted 31 May 2011 - 07:17 AM

I'm working with the book Agile Web Development with Yii. In Chapter 8, it creates a php script to set up a RBAC (role based access control) so that when we access the shell at
/framework/yiic shell

it should allow us to enter a command

rbac

Pursuant to the PHP script that we created, the command creates three roles, Owner, Member and Reader with various permissions.

My problem is that, working with MAMP, when I do the command

/framework/yiic shell


or

/Applications/MAMP/framework/yiic shell

it says

-bash: yiic: command not found


Therefore, I can't create these roles, and then I can't continue along with the book, because I don't know any work around. I had a similar problem in the earlier chapters, but was able to use Gii to generate the classes and models. But i don't know how to use Gii to create the roles in case I can't do it with the shell.

Can anyone help?

UPDATE

I did
chmod +x yiic


and now when I do
/framework/yiic shell


it seems to enter the shell, but when I type "help" it doesn't give me the commands controller crud module rbac etc. Rather it gives me all these general commands

The shell it gives me

Error: index.php does not exist or is not an entry script file.

USAGE
  yiic shell [entry-script | config-file]

DESCRIPTION
  This command allows you to interact with a Web application
  on the command line. It also provides tools to automatically
  generate new controllers, views and data models.

  It is recommended that you execute this command under
  the directory that contains the entry script file of
  the Web application.

PARAMETERS
 * entry-script | config-file: optional, the path to
   the entry script file or the configuration file for
   the Web application. If not given, it is assumed to be
   the 'index.php' file under the current directory.



The general commands (but not crud or rbac etc)

A star (*) next to a name means that the command is disabled.

 JOB_SPEC [&]                       (( expression ))
 . filename [arguments]             :
 [ arg... ]                         [[ expression ]]
 alias [-p] [name[=value] ... ]     bg [job_spec ...]
 bind [-lpvsPVS] [-m keymap] [-f fi break [n]
 builtin [shell-builtin [arg ...]]  caller [EXPR]
 case WORD in [PATTERN [| PATTERN]. cd [-L|-P] [dir]
 command [-pVv] command [arg ...]   compgen [-abcdefgjksuv] [-o option
 complete [-abcdefgjksuv] [-pr] [-o continue [n]
 declare [-afFirtx] [-p] [name[=val dirs [-clpv] [+N] [-N]
 disown [-h] [-ar] [jobspec ...]    echo [-neE] [arg ...]
 enable [-pnds] [-a] [-f filename]  eval [arg ...]
 exec [-cl] [-a name] file [redirec exit [n]
 export [-nf] [name[=value] ...] or false
 fc [-e ename] [-nlr] [first] [last fg [job_spec]
 for NAME [in WORDS ... ;] do COMMA for (( exp1; exp2; exp3 )); do COM
 function NAME { COMMANDS ; } or NA getopts optstring name [arg]
 hash [-lr] [-p pathname] [-dt] [na help [-s] [pattern ...]
 history [-c] [-d offset] [n] or hi if COMMANDS; then COMMANDS; [ elif
 jobs [-lnprs] [jobspec ...] or job kill [-s sigspec | -n signum | -si
 let arg [arg ...]                  local name[=value] ...
 logout                             popd [+N | -N] [-n]
 printf [-v var] format [arguments] pushd [dir | +N | -N] [-n]
 pwd [-LP]                          read [-ers] [-u fd] [-t timeout] [
 readonly [-af] [name[=value] ...]  return [n]
 select NAME [in WORDS ... ;] do CO set [--abefhkmnptuvxBCHP] [-o opti
 shift [n]                          shopt [-pqsu] [-o long-option] opt
 source filename [arguments]        suspend [-f]
 test [expr]                        time [-p] PIPELINE
 times                              trap [-lp] [arg signal_spec ...]
 true                               type [-afptP] name [name ...]
 typeset [-afFirtx] [-p] name[=valu ulimit [-SHacdfilmnpqstuvx] [limit
 umask [-p] [-S] [mode]             unalias [-a] name [name ...]
 unset [-f] [-v] [name ...]         until COMMANDS; do COMMANDS; done
 variables - Some variable names an wait [n]


0

#2 User is offline   georgebuckingham 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 62
  • Joined: 25-May 11
  • Location:London, UK

Posted 02 June 2011 - 10:43 AM

Where are you calling the yiic script from? As in, are you calling from your project directory? Try calling yiic like this:
(current directory): /path/to/my/project /path/to/yii/framework/yiic shell

Hope that makes sense
[url="http://georgebuckingham.co.uk"][/url]
0

#3 User is offline   luckymancvp 

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

Posted 10 June 2011 - 02:30 AM

I have same problem.
When my current directory is application directory , Seem it run index.php rather run shell application.
0

#4 User is offline   Duc Tran 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 12
  • Joined: 14-July 11

Posted 14 July 2011 - 02:21 PM

I had the same problem several days ago.
You should navigate to :
$ cd /path/to/Webroot/trackstar

You can use either:
protected/yiic shell

or:
../YiiRoot/framework/yiic shell

0

#5 User is offline   Jing Guo 

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

Posted 25 November 2012 - 10:06 PM

I got the same problem at the begining!

Here is my solution:

$cd /var/www/my_web_application_path/
$sudo YiiRoot/framework/yiic shell protected/config/main.php

0

#6 User is offline   AndreiCurelaru 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 39
  • Joined: 11-November 12
  • Location:France

Posted 26 November 2012 - 05:55 AM

Hi,

For me **it worked** with :

./yiic shell



on the command line from inside your "framework" folder !

Give it a try ;)
Les Tags pour organiser le Forum FrenchYii : LINK
@AndreiCurelaru
0

Share this topic:


Page 1 of 1
  • 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