right way to install cakephp-scripts for v2.2.1?

2019-05-04 11:11发布

问题:

I am using ubuntu and as per instruction I use 'apt-get isntall cakephp-scripts'

I am using latest stable release of cake v 2.2.1, but when I run cake bake -app , I always get console for v1.3.2

Why do I get CakePHP v1.3.2 Console on cakephp v 2.2.1

回答1:

As the others already pointed out, CakePHP from the repositories is v1.3.2 which doesn't work with your 2.1.

After uninstalling (sudo apt-get remove cakephp-scripts) it, do the following:

  1. Download CakePHP 2.1 and extract it somewhere globally available (e.g. /usr/share/php/cakephp/
  2. Check the permissions: /usr/share/cakephp/ and all subfolders should be readable for everyone and /usr/share/cakephp/app/Console/cake should be executable.
  3. Now link your executable from /usr/bin/:

    cd /usr/bin
    ln -s /usr/share/php/cakephp/app/Console/cake cake
    
  4. You should now be able to use the right version of the script everywhere from the console.

If you want to make the version of cake switchable comfortably, you should put the sources in a subfolder, i.e. /usr/share/php/cakephp/2.1/ and link there: ln -s 2.1 current. Now you can link from /usr/bin to your current directory: ln -s /usr/share/php/cakephp/current/app/Console/cake cake. If you ever want to switch versions, the only thing you have to do is to change, where current links to.



回答2:

Check your PATH variable in Linux, it might be pointing to an old version of cake



回答3:

Instead of running cake bake directly run it fromcakeDir/app by doing Console/cake bake. The thing is that install cakephp-scripts installs and old version of the cake scripts.



回答4:

Go to your terminal

1. sudo apt-get remove cakephp-scripts 
2.cd /var/www/html/yourproject/app/Console/
3.sh cake bake

I think you will be able to use cake bake console with your cakePHP same version.