I’ve checked the path on the unix socket compared to the my.cnf file and that is right and I can’t see any change to my error when I add it. It’s good to know how services interact with each other, the apps we’re all writing sometimes do the same. Don’t rush into it and revert changes if it doesn’t resolve the issue. I would advise to check one thing at a time, maybe start with the TCP socket. Maybe it has something to do with user permissions, the web server and CLI version of PHP may run under different users. Now this all doesn’t matter if your db component configuration is the same in both main.php and console.php and in the webapp the connection works. It should listen only on 127.0.0.1 not to allow external connections or a good firewall should be installed and proper passwords set on superuser accounts. When you change ‘localhost’ to ‘127.0.0.1’ the driver will use a TCP socket, but the server could have it disabled for security reasons. Search for a section and check the path there. There are many sections in the my.cnf file as it is used both by the server and all clients. I don’t use MySQL much but this error could refer to it. It’s location is specified in the my.cnf file. When connecting to MySQL if you specify host by ‘localhost’ it is treated as a switch to unix socket. I’ve checked the db and user settings, and in fact could connect via the main.php settings through the app itself. In researching this, i’ve seen suggestions of changing localhost to 127.0.0.1 and for adding a unix socket command to the end of the connectionString but neither work. 'connectionString' => 'mysql:host=localhost dbname=yii_trackstar', have set my main.php and console.php settings to the following: #14 /Applications/MAMP/htdocs/yii-sandbox/projects/trackstar/protected/yiic(4): require_once('/Applications/M.') #13 /Applications/MAMP/htdocs/yii-sandbox/projects/trackstar/protected/yiic.php(7): require_once('/Applications/M.') #12 /Applications/MAMP/htdocs/yii-sandbox/framework/yiic.php(33): CApplication->run() #11 /Applications/MAMP/htdocs/yii-sandbox/framework/base/CApplication.php(180): CConsoleApplication->processRequest() #10 /Applications/MAMP/htdocs/yii-sandbox/framework/console/CConsoleApplication.php(92): CConsoleCommandRunner->run(Array) #9 /Applications/MAMP/htdocs/yii-sandbox/framework/console/CConsoleCommandRunner.php(71): CConsoleCommand->run(Array) #8 /Applications/MAMP/htdocs/yii-sandbox/framework/console/CConsoleCommand.php(172): ReflectionMethod->invokeArgs(Object(MigrateCommand), Array) #6 /Applications/MAMP/htdocs/yii-sandbox/framework/cli/commands/MigrateCommand.php(84): MigrateCommand->getNewMigrations() #5 /Applications/MAMP/htdocs/yii-sandbox/framework/cli/commands/MigrateCommand.php(482): MigrateCommand->getMigrationHistory(-1) #4 /Applications/MAMP/htdocs/yii-sandbox/framework/cli/commands/MigrateCommand.php(451): MigrateCommand->getDbConnection() #3 /Applications/MAMP/htdocs/yii-sandbox/framework/cli/commands/MigrateCommand.php(442): CModule->getComponent('db') #2 /Applications/MAMP/htdocs/yii-sandbox/framework/base/CModule.php(387): CDbConnection->init() #1 /Applications/MAMP/htdocs/yii-sandbox/framework/db/CDbConnection.php(308): CDbConnection->setActive(true) #0 /Applications/MAMP/htdocs/yii-sandbox/framework/db/CDbConnection.php(330): CDbConnection->open() I’m trying to figure out the db Migration tools, and have this happen:Įxception 'CDbException' with message 'CDbConnection failed to open the DB connection: SQLSTATE No such file or directory' in /Applications/MAMP/htdocs/yii-sandbox/framework/db/CDbConnection.php:382 I’m still learning Yii, and am hitting a roadblock.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |