我想在Ubuntu上运行Cake Bake。需要说明的是:
- 环境、文件系统、数据库和DebugKit都很好,就像CakePhp生成的第一页上提到的那样。
- 此时“bin/cake bake”显示此消息:
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/20151012/php_intl.dll' - /usr/lib/php/20151012/php_intl.dll: cannot open shared object file: No such file or directory in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/20151012/php_mbstring.dll' - /usr/lib/php/20151012/php_mbstring.dll: cannot open shared object file: No such file or directory in Unknown on line 0
Welcome to CakePHP v3.4.5 Console
---------------------------------------------------------------
App : src
Path: /opt/lampp/htdocs/quizz/src/
PHP : 7.0.18-1+deb.sury.org~xenial+1
---------------------------------------------------------------
The following commands can be used to generate skeleton code for your application.
Available bake commands:
- all
- behavior
- cell
- component
- controller
- fixture
- form
- helper
- mailer
- migration
- migration_diff
- migration_snapshot
- model
- plugin
- seed
- shell
- shell_helper
- task
- template
- test
By using `cake bake [name]` you can invoke a specific bake task.
- 每次我运行'bin/cake bake model questions'或'bin/cake bake all'时,我都会得到以下输出:
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/20151012/php_intl.dll' - /usr/lib/php/20151012/php_intl.dll: cannot open shared object file: No such file or directory in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/20151012/php_mbstring.dll' - /usr/lib/php/20151012/php_mbstring.dll: cannot open shared object file: No such file or directory in Unknown on line 0
Welcome to CakePHP v3.4.5 Console
---------------------------------------------------------------
App : src
Path: /opt/lampp/htdocs/quizz/src/
PHP : 7.0.18-1+deb.sury.org~xenial+1
---------------------------------------------------------------
One moment while associations are detected.
Exception: SQLSTATE[HY000] [2002] No such file or directory in [/opt/lampp/htdocs/quizz/vendor/cakephp/cakephp/src/Database/Driver/PDODriverTrait.php, line 47]
2017-05-07 14:24:47 Error: [PDOException] SQLSTATE[HY000] [2002] No such file or directory in /opt/lampp/htdocs/quizz/vendor/cakephp/cakephp/src/Database/Driver/PDODriverTrait.php on line 47
Stack Trace:
# 0 /opt/lampp/htdocs/quizz/vendor/cakephp/cakephp/src/Database/Driver/PDODriverTrait.php(47): PDO->__construct('mysql:host=loca...', 'root', '', Array)
# 1 /opt/lampp/htdocs/quizz/vendor/cakephp/cakephp/src/Database/Driver/Mysql.php(104): Cake\Database\Driver\Mysql->_connect('mysql:host=loca...', Array)
# 2 /opt/lampp/htdocs/quizz/vendor/cakephp/cakephp/src/Database/Schema/BaseSchema.php(45): Cake\Database\Driver\Mysql->connect()
# 3 /opt/lampp/htdocs/quizz/vendor/cakephp/cakephp/src/Database/Dialect/MysqlDialectTrait.php(63): Cake\Database\Schema\BaseSchema->__construct(Object(Cake\Database\Driver\Mysql))
# 4 /opt/lampp/htdocs/quizz/vendor/cakephp/cakephp/src/Database/Schema/Collection.php(52): Cake\Database\Driver\Mysql->schemaDialect()
# 5 /opt/lampp/htdocs/quizz/vendor/cakephp/cakephp/src/Database/Schema/CachedCollection.php(42): Cake\Database\Schema\Collection->__construct(Object(Cake\Database\Connection))
# 6 /opt/lampp/htdocs/quizz/vendor/cakephp/cakephp/src/Database/Connection.php(367): Cake\Database\Schema\CachedCollection->__construct(Object(Cake\Database\Connection), true)
# 7 /opt/lampp/htdocs/quizz/vendor/cakephp/cakephp/src/Database/Connection.php(386): Cake\Database\Connection->getSchemaCollection()
# 8 /opt/lampp/htdocs/quizz/vendor/cakephp/bake/src/Shell/Task/ModelTask.php(959): Cake\Database\Connection->schemaCollection()
# 9 /opt/lampp/htdocs/quizz/vendor/cakephp/bake/src/Shell/Task/ModelTask.php(911): Bake\Shell\Task\ModelTask->_getAllTables()
# 10 /opt/lampp/htdocs/quizz/vendor/cakephp/bake/src/Shell/Task/ModelTask.php(207): Bake\Shell\Task\ModelTask->listAll()
# 11 /opt/lampp/htdocs/quizz/vendor/cakephp/bake/src/Shell/Task/ModelTask.php(127): Bake\Shell\Task\ModelTask->getAssociations(Object(Cake\ORM\Table))
# 12 /opt/lampp/htdocs/quizz/vendor/cakephp/bake/src/Shell/Task/ModelTask.php(110): Bake\Shell\Task\ModelTask->getTableContext(Object(Cake\ORM\Table), 'answers', 'Answers')
# 13 /opt/lampp/htdocs/quizz/vendor/cakephp/bake/src/Shell/Task/ModelTask.php(97): Bake\Shell\Task\ModelTask->bake('Answers')
# 14 /opt/lampp/htdocs/quizz/vendor/cakephp/cakephp/src/Console/Shell.php(472): Bake\Shell\Task\ModelTask->main('answers')
# 15 /opt/lampp/htdocs/quizz/vendor/cakephp/cakephp/src/Console/Shell.php(465): Cake\Console\Shell->runCommand(Array, false, Array)
# 16 /opt/lampp/htdocs/quizz/vendor/cakephp/cakephp/src/Console/ShellDispatcher.php(230): Cake\Console\Shell->runCommand(Array, true, Array)
# 17 /opt/lampp/htdocs/quizz/vendor/cakephp/cakephp/src/Console/ShellDispatcher.php(182): Cake\Console\ShellDispatcher->_dispatch(Array)
# 18 /opt/lampp/htdocs/quizz/vendor/cakephp/cakephp/src/Console/ShellDispatcher.php(128): Cake\Console\ShellDispatcher->dispatch(Array)
# 19 /opt/lampp/htdocs/quizz/bin/cake.php(34): Cake\Console\ShellDispatcher::run(Array)
# 20 {main}
- 当我输入“bin/cake bake controller questions”时,Cake Bake运行。
经过几个小时的努力,我还是没有弄清楚问题出在哪里。我一直在使用蛋糕烘焙的窗口,我从来没有发现这样的困难运行蛋糕烘焙。我真的很感激你能提供的任何帮助。
2条答案
按热度按时间qeeaahzv1#
最后....只需将localhost替换为127.0.0.1
签署人:
0sgqnhkj2#
当我在app.default.php默认数据资源和app.php中更改'host' =〉'127.0.0.1'时,我的工作正常
希望能帮上忙
谢谢