简体   繁体   中英

How to Deploy a Cake PHP App

I wonder if someone can help me. I've been handed in a Cake PHP app that I need to 1) add minor changes 2) deploy. I've never really worked with Cake before and was wondering whether do I need to anything in order for it to work?

For instance, With a Node app, you need to install modules npm install . With a Rails app you'll likely need to install the gems bundle install .

Is there something similar with Cake? I've set the localhost server, but when I try to access the url I get all sort of errors. Some I've fixed (missing environment settings which I just override the Redis host and port). The latest one is:

{
  "exception":{
    "class":"MissingControllerException",
    "code":404,
    "message":"Controller class Controller could not be found.",
    "file":"\/Library\/WebServer\/Documents\/php\/oompbe\/vendors\/cakephp\/lib\/Cake\/Routing\/Dispatcher.php",
    "line":154,
    "trace":[
      "#0 \.../app\/webroot\/index.php(109): Dispatcher->dispatch(Object(CakeRequest), Object(CakeResponse))",
      "#1 {main}"
    ]
  }
} 

PS: What's up with all the crazy \\/\\/ ? PPS: Can I find out the version Cake I'm running?

CakePHP is just php. As most properly done php apps these days it comes with composer . I recommend you to read at least the basics of it's manual. Composer is an awesome tool.

git clone <repo>
cd <reponame>
composer install

If you start a new Cake application the official documentation tells you how to this as well:

composer create-project --prefer-dist cakephp/app [app_name]

If you want to automate things further composer provides you callback scripts . They'll allow you to automate tasks, basically trigger commands, after different actions. This is pretty useful to build assets after a composer update for example. I recommend you to not put lots of commands into that section but instead have dedicated script files you trigger by the callbacks.

Can I find out the version Cake I'm running?

If installed via composer it is usually in vendor/cakephp/cakephp/version.txt . Check the content of that file.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM