简体   繁体   English

如何部署Cake PHP应用程序

[英]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. 我已经递交了一个Cake PHP应用程序,我需要1)添加较小的更改2)部署。 I've never really worked with Cake before and was wondering whether do I need to anything in order for it to work? 我以前从未真正与Cake合作过,并且想知道我是否需要任何东西才能使其正常工作?

For instance, With a Node app, you need to install modules npm install . 例如,使用Node应用程序,您需要安装模块npm install With a Rails app you'll likely need to install the gems bundle install . 使用Rails应用程序,您可能需要安装gems bundle install

Is there something similar with Cake? Cake有类似的东西吗? I've set the localhost server, but when I try to access the url I get all sort of errors. 我已经设置了本地主机服务器,但是当我尝试访问URL时,会遇到各种错误。 Some I've fixed (missing environment settings which I just override the Redis host and port). 我已经修复了一些问题(缺少环境设置,而我只是覆盖Redis主机和端口)。 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 \\/\\/ ? PS:所有疯狂的\\/\\/怎么了? PPS: Can I find out the version Cake I'm running? PPS:我可以找出我正在运行的Cake版本吗?

CakePHP is just php. CakePHP只是php。 As most properly done php apps these days it comes with composer . 作为当今最常用的php应用程序,它随composer一起提供 I recommend you to read at least the basics of it's manual. 我建议您至少阅读本手册的基础知识。 Composer is an awesome tool. Composer是一个很棒的工具。

git clone <repo>
cd <reponame>
composer install

If you start a new Cake application the official documentation tells you how to this as well: 如果您启动一个新的 Cake应用程序, 那么官方文档也会告诉您如何执行此操作:

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

If you want to automate things further composer provides you callback scripts . 如果您想使事情自动化,则composer还提供了回调脚本 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. 例如,这对于在composer update后构建资产非常有用。 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? 我可以找到我正在运行的Cake版本吗?

If installed via composer it is usually in vendor/cakephp/cakephp/version.txt . 如果通过composer安装,则通常位于vendor/cakephp/cakephp/version.txt Check the content of that file. 检查该文件的内容。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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