How to connect to DB, when running via command line
Asked Answered
W

1

11

When I run zend framework project from browser, everything is OK, it connects to DB.

When I run project from command line it can't connect to DB and it throws an error:

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

I have used Running a Zend Framework action from command line 's answers ( https://mcmap.net/q/300362/-running-a-zend-framework-action-from-command-line )

It's my application.ini file's db part

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"
Wersh answered 7/12, 2011 at 11:25 Comment(0)
M
1

Copy the content of application.ini in your php.ini file, this should work fine.

Molasses answered 7/12, 2011 at 12:9 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.