11
當我從瀏覽器運行zend框架項目時,一切正常,它連接到數據庫。如何連接數據庫,當通過命令行運行時
當我運行命令行項目中它不能連接到數據庫,它拋出一個錯誤:
Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[HY000] [2002] No such file or directory' in /usr/local/zend/share/ZendFramework/library/Zend/Db/Adapter/Pdo/Abstract.php:129
我已經使用 Running a Zend Framework action from command line的答案(https://stackoverflow.com/a/4706966/457033)
這是我application.ini
文件的db部分
phpSettings.mysql.default_socket=/usr/local/zend/mysql/tmp/mysql.sock
resources.db.adapter = "PDO_MYSQL"
resources.db.params.host = "localhost"
resources.db.params.port = 3306
resources.db.params.username = "root"
resources.db.params.password = "root"
resources.db.params.dbname = "iteam"
resources.db.isDefaultTableAdapter = true
resources.db.params.charset = "utf8"
它不工作:( – hhs