I am using CakePHP 3.0 for my first project and using Netbeans IDE.
I downloaded CakePHP 3 plugin from github : junichi11.
Project is running well in browser. But unable to use bake command.
On running bake command from right click on project >> CakePHP3 >> run command and selecting bake all gives a list of possible models and there is no input console to make selection or enter any command.
Baking from terminal in Ubuntu 14.04 gives this
[commands are highlighted in yellow]
How to run command like cake bake all admins
You have to fill the parameters field
Related
I am using Cakephp 3.x but i want to know the exact version number using command line ? is there any command available which can show us the correct version which we are using in our application ?
i know we can use this echo Configure::version(); to check version using code, i was just curious to know if i can come to know the same thing using command line interface only..
FYI, i have windows 7 as OS, xampp as server with composer and other stuff installed in my cakephp application ..
Command for any OS (ubuntu,windows) will be welcomed to come to know about it ..
Thanks
According to their documentation for version 3.x , this is how you can do this. Shells, Tasks & Console Tools
In which they have mentioned to go to directory first using command line tool and then by typing bin/cake Something like this
cd /path/to/app
bin/cake
And in response you will be able to see not only CakePHP's current version but also PHP's current version and few more information.
Welcome to CakePHP v3.0.0 Console
---------------------------------------------------------------
App : App
Path: /Users/markstory/Sites/cakephp-app/src/
---------------------------------------------------------------
Current Paths:
-app: src
-root: /Users/markstory/Sites/cakephp-app
-core: /Users/markstory/Sites/cakephp-app/vendor/cakephp/cakephp
Changing Paths:
Your working path should be the same as your application path. To change your path use the '-app' param.
Example: -app relative/path/to/myapp or -app /absolute/path/to/myapp
Available Shells:
[Bake] bake
[Migrations] migrations
[CORE] i18n, orm_cache, plugin, routes, server
[app] behavior_time, console, orm
To run an app or core command, type cake shell_name [args]
To run a plugin command, type cake Plugin.shell_name [args]
To get help on a specific command, type cake shell_name --help
Also I am not so sure this will work for older version than CakePHP 3.x as I have tried this in version 3.x only.. so please take a note on that too.
Because it doens't show the version when simply typing bin/cake in the project forlder, I also recommend this approach:
Browse to your project forlder
continue browsing to the bin forlder ( cd bin)
then type cake version
That works for me and it shown 3.5.6
Also I recommend including PHP in the system or user path if so you can type php -version anywhere in the prompt to get your php version.
I'm using cakephp to develop my project and I want to create models using the command prompt as that is easier than creating models manually. As I'm using the windows environment.
I edited the path in my computer/advanced settings/environment variable/system variable as below.
%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\MySQL\MySQL Server 5.0\bin;C:\Program Files\TortoiseSVN\bin;C:\wamp\www\fit or fat\lib\Cake\Console;
(I have renamed my cakephp folder as fit or fat)
But whwn I enter the 'cake bake ' command in cmd I'm getting the error message that cake is not recognized as an internal or external command.
Is there anything else I have to do/
In Windows you need to use cake.bat instead just cake which is for *nix.
Also you can run bake without environment variables setting just do the following
cd "C:\wamp\www\fit or fat"
lib\Cake\Console\cake.bat bake
but you need to setup correct correct path to your php anyway.
If you want to just run bake without any setting do the following
cd "C:\wamp\www\fit or fat"
c:\wamp\php\bin\php.exe lib\Cake\Console\cake.php bake
please check path to your php executable, it can differ from mine c:\wamp\php\bin\php.exe
I am running a cakePHP app which is located in C:xammp\htdocs\scheduling. I am running it on xampp on Windows 7. I have added the following environment variables:
C:\xampp\htdocs\scheduling\app\Console\;C:\xampp\php;
but still cannot get the cakephp console in operation. When I navigate to C:\xampp\htdocs\scheduling\app and try to get the cake console or cake help, I am given a message that it is not recognized as an internal or external command.
And yes, I did reload the cmd after adding the environment variables.
Its Easy just follow the steps as mentioned below:
put Your PHP Path in environment Variable
Open Command Prompt with Admin priviliges
change directory to C:\xampp\htdocs\your_appname\app\console
Type in " Cake Bake " and run
And You Are ready to go...................Happy Baking...........................
Just reloading the cmd is not enough, you need to either reboot your system or add it once manually before you are ready to reboot:
set Path="%Path%;c:\xampp\htdocs\scheduling\app\Console"
If all else fails, you can always call it in full from your app dir:
Console\cake bake
It's a little bit more typing, but this will work regardless of the Path variable settings.
i am using Cakephp2 and i am trying to baking my application using commandprompt
here is my steps
c:/>xampp\htdocs\projectname\app>..\cake\console\cake bake
it doesnot work .
But if i use cakephp1.3 with same steps it works fine and look like as
Interactive Bake Shell
[D]atebase Configuration
[M]odel
so on
AnyBody Tell me what to do ?
Thanks
The location of the Cake console has changed in 2.0. It's in: YOUR_CAKE_DIR/lib/Cake/Console/. Change YOUR_CAKE_DIR to the path to your Cake installation and you should be able to invoke cake bake again.
Just realised you're developing on Windows, I guess, in that case, the path becomes:
c:/>xampp\htdocs\projectname\app>..\lib\Cake\Console\cake bake
You can do it without changing your path variables.
For window machine and xampp you can do following step to bake:-
Type cd\ press enter
Type cd:/xampp/php press enter
Type php.exe C:/xampp/htdocs/projectName/lib/cake/console/cake.php bake press enter
1st assign proper path variables in your computer
2nd install updated cakephp2 files
3rd open cli , like MAMP/htdocs/project/app/console -> cake bake or i recommend cake bake all
Let me know if you need more guidance
I am using Ubuntu + cakephp 1.3. I am trying the database migration with the help of cakeDC migration plugin. I configured the plugin as per the instructions.
But when i goes to the terminal, goes to the path of the application application_path/app/ dir then fire a command 'cake migration help' it gives me following error,
Hello user,
Welcome to CakePHP v1.2 Console
Current Paths:
-working: /path/to/cake/
-root: /path/to/cake/
-app: /path/to/cake/app/
-core: /path/to/cake/
Changing Paths:
your working path should be the same as your application path
to change your path use the '-app' param.
Example: -app relative/path/to/myapp or -app /absolute/path/to/myapp
Available Shells:
app/vendors/shells/:
- none
vendors/shells/:
- none
cake/console/libs/:
acl
api
bake
console
extract
To run a command, type 'cake shell_name [args]'
To get help on a specific command, type 'cake shell_name help'
Then i followed the steps given in the :
http://book.cakephp.org/view/108/The-CakePHP-Console
$ cake -app /path/to/app
But i am not getting the success. Can anybody help me out from this issue...
Thanks in adavnce.
You're executing cake shell, which is somewhere in your $PATH (type which cake to see which one comes in $PATH first). To run cake shell belonging to your app (version 1.3), execute /path/to/your/application/cake/console/cake (if you're in your /app dir, simply execute ../cake/console/cake) with any options you may need (like -app).