I am new to the cakePHP and first starting to bake so I face this problem when following a tutorial and do the following:
Add paths to php and cakePHP
Run the CMD and type "cake" and get the following message:
Welcome to CakePHP v2.2.3 Console
---------------------------------------------------------------
App : C:
Path: C:\
---------------------------------------------------------------
Current Paths:
-app: C:
-working: C:
-root: C:
-core: C:\xampp\cake\lib
Changing Paths:
Your working path should be the same as your application path to change your pat
h use the '-app' param.
Example: -app relative/path/to/myapp or -app /absolute/path/to/myapp
Available Shells:
[CORE] acl, api, bake, command_list, console, i18n, schema, test, testsuite, upg
rade
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
3.I type in the path where the app that's being developed is saved, that is:C:\xampp\htcdocs\blog
I have tried to add all possible paths like
C:...blog\app,
C:...blog\app\console,
C:...blog\lib\cake\console,
but I still get the message that the system cannot find the path specified.
I have been looking for the solution for couple of hours now and could only find it for the previous versions of cakePHP or any other OS but Windows 7.
You may want to set your path to folder/app/console of your project. Also to the folder where php.exe resides. This is the way i've set mine and works for me.
Try typing cake help in cmd, it should show cake help file.
edit: i have change this answer so everyone can have cake configured ok!
C:\xampp\htdocs\proyecto\app>set PATH=C:\Program Files\Common Files\Microsoft Sh
ared\Windows Live;C:\windows\system32;C:\windows;C:\windows\System32\Wbem;C:\win
dows\System32\WindowsPowerShell\v1.0\;C:\Program Files\Windows Live\Shared;C:\Pr
ogram Files\TortoiseSVN\bin;C:\xampp\htdocs\proyecto\app\Console;C:\xampp\php;
then from your "project" folder (in my case "proyecto") go to app in a cmd window and type "cake help" it should show something like:
Welcome to CakePHP v2.2.1 Console
App : app
Path: C:\xampp\htdocs\proyecto\app\
Current Paths:
-app: app
-working: C:\xampp\htdocs\proyecto\app
-root: C:\xampp\htdocs\proyecto
-core: C:\xampp\htdocs\proyecto\lib
wich means, everything is good to go!
start the command promt
type cd\ press enter and then cd:/xampp/php press enter
php.exe C:/xampp/htdocs/cakeblog/lib/cake/console/cake.php bake press enter
where “C:/xampp/htdocs/cakeblog/lib/cake/console/cake.php” is the path of bake file.
Have Baking!
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 found that the explanations in
the cookbook do not match my own experiences with the bake shell.
When I run ./cake bake from the shell, I don't get the output as specified above, instead it asks me for an app path and a skeleton path, and then wants to bake a whole application.
I have written most of my code and would like to just bake a single view, i.e. a form for this view. I would like to have the interactive shell like I knew it from 1.3 but I might be doing something wrong.
Like this:
---------------------------------------------------------------
App : app
Path: /path-to/project/app
---------------------------------------------------------------
Interactive Bake Shell
---------------------------------------------------------------
[D]atabase Configuration
[M]odel
[V]iew
[C]ontroller
[P]roject
[F]ixture
[T]est case
[Q]uit
What would you like to Bake? (D/M/V/C/P/F/T/Q)
>
Edit:
Here is the output when I just run ./cake
Current Paths:
-app: Console
-working: /home/username/Aptana Studio 3 Workspace/aurinko/aurinko/app/Console
-root: /home/username/Aptana Studio 3 Workspace/aurinko/aurinko/app
-core: /home/username/Aptana Studio 3 Workspace/aurinko/aurinko/lib
My working app lies in the path specified as root. What do I need to set app to, in order to just generate single views?
I think I did not try enough. With this command it worked:
./cake bake -app /home/username/Aptana\ Studio\ 3\ Workspace/aurinko/aurinko/app/
Now the interactive shell appears as known from 1.3.
Maybe this helps somebody.
I've installed the latest version of CakePHP on a Ubuntu 10.10 machine. I was able to run through a beginner tutorial just fine so I think my configuration is close to being correct. I can't get cake bake to completely work though. Below is my session. Things that look like anomolies are in bold. I think I must have one or more small errors in my configuration that are manifesting when running the bake shell. Thanks!
ubuntu#myserver.com:~$ cd /var/www/app
ubuntu#myserver.com:/var/www/app$ ../cake/console/cake bake -app /var/www/app
Failed loading /usr/lib/php5/20090626.so: /usr/lib/php5/20090626.so: cannot open shared object
file: No such file or directory
Welcome to CakePHP v1.3.2 Console
App : app
Path: /var/www/app
Interactive Bake Shell
[D]atabase Configuration
[M]odel
[V]iew
[C]ontroller
[P]roject
[F]ixture
[T]est case
[Q]uit
What would you like to Bake? (D/M/V/C/P/F/T/Q)
P
What is the full path for this app including the app directory name?
Example:/var/www/app/myapp
[/var/www/app/myapp] > /var/www/app
Bake Project
Skel Directory: /usr/share/php/cake/console/templates/skel
Will be copied to: /var/www/app
Look okay? (y/n/q)
[y] > y
Do you want verbose output? (y/n)
[n] > y
Created: app in /var/www/app
/usr/share/php/cake/console/templates/skel/app_controller.php copied to
/var/www/app/app_controller.php
/usr/share/php/cake/console/templates/skel/app_model.php copied to
/var/www/app/app_model.php
/usr/share/php/cake/console/templates/skel/index.php copied to /var/www/app/index.php
/usr/share/php/cake/console/templates/skel/.htaccess copied to /var/www/app/.htaccess
/usr/share/php/cake/console/templates/skel/app_helper.php copied to /var/www/app/app_helper.php
Creating file /var/www/app/views/pages/home.ctp
File /var/www/app/views/pages/home.ctp exists, overwrite? (y/n/q)
[n] > y
Wrote /var/www/app/views/pages/home.ctp
Welcome page created
Random hash key created for 'Security.salt'
Random seed created for 'Security.cipherSeed'
Unable to set CAKE_CORE_INCLUDE_PATH, you should change it in /var/www/app/webroot/index.php
Could not set permissions on /var/www/app//tmp
chmod -R 0777 /var/www/app//tmp
Interactive Bake Shell
[D]atabase Configuration
[M]odel
[V]iew
[C]ontroller
[P]roject
[F]ixture
[T]est case
[Q]uit
What would you like to Bake? (D/M/V/C/P/F/T/Q)
q
ubuntu#myserver.com:/var/www/app$
Mark Murphy,
1.
Failed loading /usr/lib/php5/20090626.so: /usr/lib/php5/20090626.so: cannot open shared object
*.so files are shared libraries. I would try to tackle it be (re-) installing the PHP CLI.
2.
Could not set permissions on /var/www/app//tmp
How could the slash creep in twice? Such a folder should not exist.
Edit0:
It is a bit strange, as CakePHP should work right out of the box, but maybe you really should take a look at the specified variable in app/webroot/index.php and see if you can change the CAKE_CORE_INCLUDE_PATH so that the superfluous slash vanishes.
Edit1:
For general deployment there is nothing better than this afaik.
Edit2:
cake bake help returns:
-app Absolute/Relative path to your app folder.
Hence you should call either:
cake bake app /var/www/<your_project_name>/ <---- note the trailing slash
or
when in /var/www/ call cake bake app <just_your_project_name>
Edit3:
In a nutshell: You could download the CakePHP tar.gz and unzip it in your /var/www/, then rename the folder (having some weird cakePHP-1234... name) into the name of your application, e.g. missioncontrol. Then in your browser: http://localhost/missioncontrol , proceed as instructed.
This is a very quick method to get going, but you can develop other methods according to your build process.
After you have developed your app and intend to deploy it on a host different than your local machine, use the link provided under edit1.
I'm new to cakephp so have just been working through the cookbook and am now working through "Beginning CakePHP from Novice to Professional" by Apress. I have got to the Bake section of the book but I can't seem to get it working in windows 7.
I have added the path to my "Environment Variables" so I don't have to navigate to the location of cake.bat but I can't seem to get baking to work.
I type cake bake -app C:\Program Files (x86)\Apache Software Foundation\Apache2.2\htdocs\testBlog\app\ and get:
Microsoft Windows [Version 6.1.7600]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.
C:\Users\Poncho>cake bake -app C:\Program Files (x86)\Apache Software Foundation
\Apache2.2\htdocs\testBlog\app\
♀
Welcome to CakePHP v1.3.3 Console
---------------------------------------------------------------
App : Program
Path: C:\\Program
---------------------------------------------------------------
Bake Project
Skel Directory: C:\Program Files (x86)\Apache Software Foundation\Apache2.2\htdo
cs\testBlog\cake\console\templates\skel
Will be copied to: C:\\Program\Files
---------------------------------------------------------------
Look okay? (y/n/q)
[y] >
If I type 'y' (without quotes) it runs through some stuff then asks me for the db config, I put all the info in and it finishes saving the db config info and then ends. When I try cake bake again, I just get the above screen again, everytime I try it seems to not understand I've set it up before with the Skel Directory being copied and the db info being configured.
Any idea what could be wrong?
Thanks in advance.
P.S.
My app location is at: C:\Program Files (x86)\Apache Software Foundation\Apache2.2\htdocs\testBlog\
well thats where all the cakephp stuff is. Should I have the cakephp core seperate from each app folder? Or should each app have its own cakephp stuff?
For example, should I have my cakephp files and folders (cake, plugins, vendors, etc.) in C:\Program Files (x86)\Apache Software Foundation\Apache2.2\htdocs\ and then each app in its own folder as in testBlog/app or is how I've done it okay?
Thanks All,
Infiniti Fizz
Judging by the output of the bake tool, spaces in the path seem to throw it off. Try moving your htdocs directory to a location without spaces, e.g. c:\htdocs and see if that helps.
To tell Apache that the location of the htdocs directory has changed, find the httpd.conf file (it should be somewhere under your Apache2.2 directory) and change the DocumentRoot and <Directory ... > to the new location. Make sure to keep the trailing slash, then restart Apache.
As for separating CakePHP files from your application, you can do it either way. I like to keep CakePHP files and the app in a single repository, so I can check out the project and get it working right away. Keeping the core files separate from your applications could save you time when updating CakePHP, especially if you have many apps. If I were starting out with CakePHP, I'd use the former method and focus on becoming familiar with the framework.
I guess, you don't need to really move your app folder. Just give the -app param in quotes. cake bake -app "C:\Program Files (x86)\Apache Software Foundation\Apache2.2\htdocs\testBlog\app\"
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).