我正在尝试使用cakephp 3.2创建新的本地项目,遵循cakephp 文档,在 wamp 本地服务器上。我用作曲家安装它。
安装后一切似乎都正常:我在 app.php 上配置了我的 db 访问权限,并且 cakephp 默认主页确认配置一切正常(PHP 版本和扩展 OK/写权限 OK/连接到 db OK)
但是当我尝试使用烘焙命令(从我的项目根目录)时,我遇到了一个错误:
$ bin/cake bake
Could not open input file: /cygdrive/c/wamp64/www/cemafor/bin/cake.php
但是,文件 c/wamp64/www/cemafor/bin/cake.php 存在!
我尝试使用“./bin/cake bake”命令(根据cakephp bake doc 推荐),仍然是同样的错误。
也尝试删除并重新安装项目,没有变化。
我看到安装的烘焙版本是 1.2.1(查看 install 命令的结果)。我查看了 /composer.json 文件,看到了这个:
"require-dev": {
"psy/psysh": "@stable",
"cakephp/debug_kit": "~3.2",
"cakephp/bake": "~1.1"
},
所以我尝试通过以下方式更改 cakephp/bake 版本的版本值:
"cakephp/bake": "~1.2"
但是什么都改变不了...
我尝试根据bake doc安装 1.0 版,但不起作用。
并且找不到一个有同样问题的人......在这个世界上感到孤独,有一个愚蠢的错误^^
非常感谢你的帮助 !
有关信息,以下是安装命令的结果:
$ composer create-project --prefer-dist cakephp/app cemafor
Installing cakephp/app (3.2.1)
- Installing cakephp/app (3.2.1)
Loading from cache
Created project in cemafor
Loading composer repositories with package information
Installing dependencies (including require-dev)
- Installing aura/installer-default (1.0.0)
Loading from cache
- Installing cakephp/plugin-installer (0.0.12)
Loading from cache
- Installing psr/log (1.0.0)
Loading from cache
- Installing mobiledetect/mobiledetectlib (2.8.19)
Loading from cache
- Installing aura/intl (1.1.1)
Loading from cache
- Installing cakephp/chronos (0.4.7)
Loading from cache
- Installing cakephp/cakephp (3.2.3)
Loading from cache
- Installing symfony/yaml (v3.0.3)
Loading from cache
- Installing symfony/filesystem (v3.0.3)
Loading from cache
- Installing symfony/config (v3.0.3)
Loading from cache
- Installing symfony/polyfill-mbstring (v1.1.0)
Loading from cache
- Installing symfony/console (v3.0.3)
Loading from cache
- Installing robmorgan/phinx (v0.5.1)
Loading from cache
- Installing cakephp/migrations (1.5.6)
Loading from cache
- Installing jakub-onderka/php-console-color (0.1)
Loading from cache
- Installing jakub-onderka/php-console-highlighter (v0.3.2)
Loading from cache
- Installing dnoegel/php-xdg-base-dir (0.1)
Loading from cache
- Installing nikic/php-parser (v2.0.1)
Loading from cache
- Installing symfony/var-dumper (v3.0.3)
Loading from cache
- Installing psy/psysh (v0.7.1)
Loading from cache
- Installing jdorn/sql-formatter (v1.2.17)
Loading from cache
- Installing cakephp/debug_kit (3.2.6)
Loading from cache
- Installing cakephp/bake (1.2.1)
Loading from cache
symfony/console suggests installing symfony/event-dispatcher ()
symfony/console suggests installing symfony/process ()
symfony/var-dumper suggests installing ext-symfony_debug ()
psy/psysh suggests installing ext-pcntl (Enabling the PCNTL extension makes PsySH a lot happier :))
psy/psysh suggests installing ext-posix (If you have PCNTL, you'll want the POSIX extension as well.)
psy/psysh suggests installing ext-readline (Enables support for arrow-key history navigation, and showing and manipulating command history.)
psy/psysh suggests installing ext-pdo-sqlite (The doc command requires SQLite to work.)
cakephp/debug_kit suggests installing ext-sqlite (DebugKit needs to store panel data in a database. SQLite is simple and easy to use.)
Writing lock file
Generating autoload files
> Cake\Composer\Installer\PluginInstaller::postAutoloadDump
> App\Console\Installer::postInstall
Created `config/app.php` file
Set Folder Permissions ? (Default to Y) [Y,n]? Y
Updated Security.salt value in config/app.php
这是我的composer.json 内容:
{
"name": "cakephp/app",
"description": "CakePHP skeleton app",
"homepage": "http://cakephp.org",
"type": "project",
"license": "MIT",
"require": {
"php": ">=5.5.9",
"cakephp/cakephp": "~3.2",
"mobiledetect/mobiledetectlib": "2.*",
"cakephp/migrations": "~1.0",
"cakephp/plugin-installer": "*"
},
"require-dev": {
"psy/psysh": "@stable",
"cakephp/debug_kit": "~3.2",
"cakephp/bake": "^1.2"
},
"suggest": {
"phpunit/phpunit": "Allows automated tests to be run without system-wide install.",
"cakephp/cakephp-codesniffer": "Allows to check the code against the coding standards used in CakePHP."
},
"autoload": {
"psr-4": {
"App\\": "src"
}
},
"autoload-dev": {
"psr-4": {
"App\\Test\\": "tests",
"Cake\\Test\\": "./vendor/cakephp/cakephp/tests"
}
},
"scripts": {
"post-install-cmd": "App\\Console\\Installer::postInstall",
"post-autoload-dump": "Cake\\Composer\\Installer\\PluginInstaller::postAutoloadDump"
},
"minimum-stability": "stable",
"prefer-stable": true
}