无法从Zend连接到数据库

时间:2017-04-01 19:54:45

标签: php zend-framework zend-framework2 zend-db

我正在研究Zend项目,但我无法连接到数据库。

这是我的application.ini

[production]
phpSettings.display_startup_errors = 0
phpSettings.display_errors = 0
resources.frontController.params.displayExceptions = 0
includePaths.library = APPLICATION_PATH "/../library"
bootstrap.path = APPLICATION_PATH "/Bootstrap.php"
bootstrap.class = "Bootstrap"
appnamespace = "Application"
autoloadernamespaces[] = "ZendExtended"
autoloadernamespaces[] = "Jnm"
resources.frontController.controllerDirectory = APPLICATION_PATH "/controllers"
resources.layout.layoutPath = APPLICATION_PATH "/layouts/scripts/"
resources.frontController.moduleDirectory = APPLICATION_PATH "/modules"
resources.frontController.baseUrl = "/"
resources.modules[] = ""

resources.session.cookie_lifetime = 0


logs.configFile = APPLICATION_PATH "/configs/logs.ini"

resources.view[] =

javascriptPath = "js/"
cssPath = "css/"


resources.db.adapter = "Mysqli"
resources.db.params.host = "jnmfrtgeanbdddev.mysql.db"
resources.db.params.username = "user"
resources.db.params.password = "pass"
resources.db.params.dbname = "bdd"
resources.db.params.port = "3306"

register.validation = 1
register.available = 1


[preprod : production]
database.params.dbname = "database-preprod-jnm"
database.params.username = "user-preprod-mysql"

[testing : production]
phpSettings.display_startup_errors = 1
phpSettings.display_errors = 1

database.adapter = "Mysqli"
database.params.host = "127.0.0.1"
database.params.dbname = "database-test-jnm"
database.params.username = "root"
database.params.password = ""

register.validation = 1
register.available = 1

[development : production]
phpSettings.display_startup_errors = 1
phpSettings.display_errors = 1
resources.frontController.params.displayExceptions = 1

database.adapter = "Mysqli"
database.params.host = "jnmfrtgeanbdddev.mysql.db"
database.params.dbname = "bdd"
database.params.username = "user"
database.params.password = "pass"

register.validation = 1
register.available = 1

[development2 : development]

database.adapter = "Mysqli"
database.params.host = "127.0.0.1"
database.params.dbname = "database-dev-jnm"
database.params.username = "root"
database.params.password = ""

这是我在index.php中调用的Environment。我选择了production环境:

  

定义(' APPLICATION_ENV',(getenv(' APPLICATION_ENV')?   getenv(' APPLICATION_ENV'):' production'));

该网站有效,但仍未连接到数据库。这可能是什么问题?

0 个答案:

没有答案