【问题标题】:Mac Xampp Cakephp Bake ErrorMac Xampp Cakephp 烘焙错误
【发布时间】:2014-04-21 09:06:13
【问题描述】:

我在 Mac 上运行了这段代码,但出现了这个错误。

$ php cake.php bake all

$ cd /Applications/XAMPP/htdocs/cakephp/app/Console/
Kgunner-iMac:Console kgunner$ php cake.php bake all

Warning: strtotime(): It is not safe to rely on the system's timezone settings. You are         *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Asia/Calcutta' for 'IST/5.0/no DST' instead in /Applications/XAMPP/xamppfiles/htdocs/cakephp/lib/Cake/Cache/CacheEngine.php on line 60

Warning: strtotime(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Asia/Calcutta' for 'IST/5.0/no DST' instead in /Applications/XAMPP/xamppfiles/htdocs/cakephp/lib/Cake/Cache/CacheEngine.php on line 60

Welcome to CakePHP v2.4.6 Console
---------------------------------------------------------------
App : app
Path: /Applications/XAMPP/xamppfiles/htdocs/cakephp/app/
---------------------------------------------------------------
Bake All
---------------------------------------------------------------
Warning Error: PDO::__construct(): [2002] No such file or directory (trying to connect via unix:///var/mysql/mysql.sock) in [/Applications/XAMPP/xamppfiles/htdocs/cakephp/lib/Cake/Model/Datasource/Database/Mysql.php, line 175]

Error: Database connection "Mysql" is missing, or could not be created.
#0     /Applications/XAMPP/xamppfiles/htdocs/cakephp/lib/Cake/Model/Datasource/DboSource.php(260): Mysql->connect()
#1 /Applications/XAMPP/xamppfiles/htdocs/cakephp/lib/Cake/Model/ConnectionManager.php(105): DboSource->__construct(Array)
#2 /Applications/XAMPP/xamppfiles/htdocs/cakephp/lib/Cake/Console/Command/Task/ModelTask.php(927): ConnectionManager::getDataSource('default')
#3 /Applications/XAMPP/xamppfiles/htdocs/cakephp/lib/Cake/Console/Command/Task/ModelTask.php(864): ModelTask->getAllTables('default')
#4 /Applications/XAMPP/xamppfiles/htdocs/cakephp/lib/Cake/Console/Command/Task/ModelTask.php(954): ModelTask->listAll('default')
#5 /Applications/XAMPP/xamppfiles/htdocs/cakephp/lib/Cake/Console/Command/BakeShell.php(150): ModelTask->getName('default')
#6 /Applications/XAMPP/xamppfiles/htdocs/cakephp/lib/Cake/Console/Shell.php(437): BakeShell->all()
#7 /Applications/XAMPP/xamppfiles/htdocs/cakephp/lib/Cake/Console/ShellDispatcher.php(207): Shell->runCommand('all', Array)
#8 /Applications/XAMPP/xamppfiles/htdocs/cakephp/lib/Cake/Console/ShellDispatcher.php(66): ShellDispatcher->dispatch()
#9 /Applications/XAMPP/xamppfiles/htdocs/cakephp/app/Console/cake.php(36): ShellDispatcher::run(Array)
#10 {main}

我收到此烘焙错误。任何人都可以帮助如何修复它以正确烘烤。

【问题讨论】:

    标签: php macos cakephp xampp


    【解决方案1】:

    在您的 database.php 中,将您的主机从 localhost 更改为 127.0.0.1 ,它适用于我。

    【讨论】:

      【解决方案2】:

      向我们展示您的数据库配置。检查“默认”配置是否正确配置。

      注意运行控制台shell的正确位置是app文件夹:

      cd app/
      ./Console/cake bake all
      

      http://book.cakephp.org/2.0/en/console-and-shells.html#the-cakephp-console

      【讨论】:

        【解决方案3】:

        您的数据库配置有问题。正确配置数据库

        【讨论】:

        • Db 配置仅正确,因为通常在 Web 视图中的应用程序运行良好
        猜你喜欢
        • 2015-12-28
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多