The difference
The difference between the two executables is that one derives the app location from the current working directory, and the other is application specific. This can be highlighted like so:
Normal usage:
www-data @ dev [ /tmp/cakephp ] (master=)
-> app/Console/cake
Welcome to CakePHP v2.4.6 Console
---------------------------------------------------------------
App : app
Path: /tmp/cakephp/app/
---------------------------------------------------------------
Reference app executable from different path:
-> cd anywhere
-> /tmp/cakephp/app/Console/cake
Welcome to CakePHP v2.4.6 Console
---------------------------------------------------------------
App : app
Path: /tmp/cakephp/app/
---------------------------------------------------------------
Note the app and path did not change.
cake
in path
If /tmp/cakephp/lib/Cake/Console/
is in the path:
-> cd anywhere
-> cake
Welcome to CakePHP v2.4.6 Console
---------------------------------------------------------------
App : xxx
Path: **anywhere**
---------------------------------------------------------------
Note the app and path vary depending on where you are when executing the command.
If you always specify the -app
flag, they will function the same, but you'll find it is problematic to use cake in your path if for example you have multiple applications on the same host using different versions of CakePHP.
Fixing paths
If you moved the cake folder, the files you need to edit are:
- app/Console/cake.php (
$root
variable/include_path)
- app/webroot/index.php (ROOT constant)
- app/webroot/test.php (ROOT constant)
Only the first will affect cli usage.