Fatal error on Zend framework
I have installed Zend framework on Ubuntu 10.10. I just created a project with zend tool.
However if I see http://localhost/zftest/public I get the following error.
Fatal error: Uncaught exception 'Zend_Db_Adapter_Exception' with message
'Configuration array must have a key for 'password' for login credentials'
in /usr/share/php/libzend-framework-php/Zend/Db/Adapter/Abstract.php:284 Stack trace:
#0 /usr/share/php/libzend-framework-php/Zend/Db/Adapter/Abstract.php(183): Zend_Db_Adapter_Abstract->_checkRequiredOptions(Array)
#1 /usr/share/php/libzend-framework-php/Zend/Db.php(265): Zend_Db_Adapter_Abstract->__construct(Array)
#2 /usr/share/php/libzend-framework-php/Zend/Application/Resource/Db.php(142): Zend_Db::factory('PDO_MYSQL', Array)
#3 /usr/share/php/libzend-framework-php/Zend/Application/Resource/Db.php(154): Zend_Application_Resource_Db->getDbAdapter()
#4 /usr/share/php/libzend-framework-php/Zend/Application/Bootstrap/BootstrapAbstract.php(680): Zend_Application_Resource_Db->开发者_StackOverflowinit()
#5 /usr/share/php/libzend-framework-php/Zend/Application/Bootstrap/BootstrapAbstract.php(623): Zend_Application_Bootstrap_BootstrapAbstract->_executeResource('db')
#6 /usr/share/php/libzend-framewor in /usr/share/php/libzend-framework-php/Zend/Db/Adapter/Abstract.php on line 284
Could anyone tell me how to fix this?
Thanks in advance.
Zend Framework Db Adapter searches for an username and password field in your database configuration parameters if it can't find it you get that error.
You can connect to the database using no password, but you have to add the parameter password to your configuration, just leave it empty:
resources.db.adapter = MYSQLI resources.db.params.host = localhost resources.db.params.username = root resources.db.params.password =
http://framework.zend.com/manual/en/zend.db.adapter.html
精彩评论