CakePhp:蛋糕烘焙不适用于Ubuntu。 (PDOException)

时间:2017-05-07 14:42:53

标签: php mysql ubuntu cakephp cake-bake

我试图在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烘焙模型问题'或' bin / cake烘焙所有'我得到了这个输出:
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; /烘烤控制器问题'

经过数小时试图解决问题后,我没有弄清楚问题是什么。我一直在窗户上使用蛋糕烘烤,我从来没有发现蛋糕烘烤这样的困难。 我非常感谢您提供的任何帮助。

1 个答案:

答案 0 :(得分:0)

我换岗时我的工作了 'host'=>'127.0.0.1',位于app.default.php默认数据资源中 并在app.php中

希望对您有帮助

谢谢