简体   繁体   English

Mac Xampp Cakephp烘焙错误

[英]Mac Xampp Cakephp Bake Error

I ran this code on Mac and i am getting this error. 我在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}

I am getting this bake error. 我得到了这个烘烤错误。 can anyone help how to fix it to bake properly. 任何人都可以帮助如何解决它来正确烘烤。

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

You have problem with you database configuration. 您的数据库配置有问题。 configure your database properly 正确配置数据库

Show us your db config. 向我们展示你的db配置。 Check if the 'default' config is properly configured. 检查是否正确配置了“默认”配置。

Pay attention that the correct location to run the console shell is from the app folder: 注意运行控制台shell的正确位置来自app文件夹:

cd app/
./Console/cake bake all

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

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

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