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
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
Can anyone help?
UPDATE
pursuant to one of the answers below, I did chmod +x yiic
Now when I run /framework/yiic shell it seems to enter the shell but not the same one described by my book
The book tells me I should get this
% YiiRoot/framework/yiic shell Yii Interactive Tool v1.1 (based on Yii v1.1.2) Please type 'help' for help. Type 'exit' to quit. >>
Now type help to see a list of available commands:
>> help
At the prompt, you may enter a PHP statement or one of the following commands:
- controller
- crud
- form
- help
- model
- module
- rbac
Type 'help <command-name>' for details about a command.
However, I'm getting
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.
Try the full path:
/framework/yiic shell
You have to add /framework/ to your $PATH-environment variable if you want to use yiic without giving the full path.
You might need to specify the path:
/framework/yiic
or include the directory in your PATH
PATH="$PATH:/framework"
export PATH
Related
any help please DB : XAMPP , logiciel : vscode
cake : The term 'cake' is not recognized as the name of a cmdlet, function, script file, or operable
program. Check the spelling of the name, or if a path was included, verify that the path is correct
and try again.
At line:1 char:1
By default Powershell doesn't run commands from the current location, you'd for example have to lower protection by adding the directory to your path environment variable (which I wouldn't recommend). Alternatively you'd use .\ before the command, to make it clear that you want to run a command in the current directory, ie .\cake.
However you should not run cake from within the bin directory in the first place, you should run it from the root of your application, ie from within your cakephp directory, so that you'd use:
bin\cake bake
See also
Cookbook > Console Commands
Bake Cookbook > Code Generation with Bake
I am trying to make a script which automaticly loads a project from a git repository. I run exec() from a php file with name of the shell script as an argument. The script looks something like this:
git pull
php yii migrate
The git command works well, but the yii command is totally ignored. I'm doing this from the root of the directory of the yii site, so it should work, but it doesn't.
How can I fix this?
if you are using Yii version 1.x, you have to run your command from inside protected directory
cd protected
php yiic.php migrate
First of all, if you want to run console application in Yii2, just use
yii <route> [--option1=value1 --option2=value2 ... argument1 argument2 ...]
Second: yii migrate is the defined console command to upgrade a database to its latest structure. So it probably does its work, but not that you want to.
Try to rename your console command.
Reference links to read:
Guide: console commands
Guide: migrations (part with yii migrate).
I am trying to set some tests in symfony.
I am doing the first steps on that.
My question is from which folder should we write the phpunit -c app
I mean in c:/
or from the bundle
because I get the message of the not recognised internally command.
You must run it from root direcory of your application. app is just an argument which specify folder where phpunit.xml.dist places.
Im new to Yii frame work and im on their website and im trying to get my first application working.
from this link http://www.yiiframework.com/doc/guide/1.1/en/quickstart.first-app they are asking me to type % YiiRoot/framework/yiic webapp WebRoot/testdrive into the command prompt
Yii root is at this directory: E:\Documents\Webdesign\htdocs\yii\
when i type this
% E:\Documents\Webdesign\htdocs\yii\framework/yiic webapp
E:\Documents\Webdesign\htdocs/testdrive
into the cmd i get
'%' is not recognised as a internal or external command, operable program or batch file.
What could be the problem?
can any body help me to get this working?
Go to this folder using cd E:\Documents\Webdesign\htdocs\yii\framework command
After this type yiic webapp testdrive command
In this context here is the meaning of this statement:
% YiiRoot/framework/yiic webapp WebRoot/testdrive
% YiiRoot/framework/yiic - Change into the directory where you keep the yii library. In this case, you would open your terminal and type: cd E:\Documents\Webdesign\htdocs\yii\. Leave out the % sign.
webapp - Is the actual command that yiic recognises. It is the one that allows you to generate an application. That means after changing the directory, you would them type webapp. Don't press enter until you have typed in the path. So in the end, this part of your command will look like this: webapp /path/to/where/you/want/to/create/the/application
WebRoot/testdrive - Lastly, this refer to the directory where you would like your application to be created.
I hope this helps :-)
i want to schedule a task to run at certain time in php and i am using codeigniter framework .
so want to write a batch file to execute the given function in a given controller. Ihave written a batch file for simple php file its working correctly but giving an error while writing for the codeigniter.
below is my batch file for codeigniter
C:\xampp\php\php.exe -f C:\xampp\htdocs\DatabaseServices\index.php\controller_name\FUNCTION_NAME
it is giving an error 'unable to load the file'
See the Codeigniter Documentation on the CLI interface.
Now normally you would visit the your site using a URL similar to this: example.com/index.php/tools/message
Instead, we are going to open Terminal in Mac/Lunix or go to Run > "cmd" in Windows and navigate to our CodeIgniter project:
$ cd /path/to/project;
$ php index.php tools message
Make sure you are sending the right arguments for your controllers.
In your case:
cd C:\xampp\htdocs\DatabaseServices
C:\xampp\php\php.exe index.php controller_name FUNCTION_NAME