无法将 Zend 连接到 MySQL
我是 Zend Framework 的新手,正在尝试解决一些问题。我想知道是否有人可以帮助我弄清楚为什么我无法连接到我的实时服务器(Cpanel/共享式网络主机)上的 MYSQL 数据库。
我已采取以下步骤。
- 构建 Zend 框架
- 上传到 Web 主机上的文件夹
- 将“ZEND”文件夹添加到库中
- 将连接字符串内容添加到 application.ini 文件 *(a)
- 重新加载页面
*(a) 我添加的连接信息如下:
resources.db.adapter = PDO_MYSQL
resources.db.params.host = localhost
resources.db.params.username = cpanel_dbuser
resources.db.params.password = 123456
resources.db.params.dbname = cpanel_db
我收到的错误内容类似于
Fatal error: Uncaught exception 'Zend_Config_Exception' with message 'Error parsing /home/path/application/configs/application.ini on line 13 '
in /home/path/library/Zend/Config/Ini.php:181 Stack trace:
#0 /home/path/library/Zend/Config/Ini.php(201): Zend_Config_Ini->_parseIniFile('/home/path/...')
#1 /home/path/library/Zend/Config/Ini.php(125): Zend_Config_Ini->_loadIniFile('/home/path/...')
#2 /home/path/library/Zend/Application.php(383): Zend_Config_Ini->__construct('/home/path/...', 'production')
#3 /home/path/library/Zend/Application.php(85): Zend_Application->_loadConfig('/home/path/...')
#4 /home/path/public/index.php(25): Zend_Application->__construct('production', '/home/path/...')
#5 {main} thrown in /home/path/library/Zend/Config/Ini.php on line 18
编辑 我的 application.ini 的第 13 行是密码。 其中有一个感叹号。 如果我更改数据库用户的密码,现在就可以了。
Zend DB 密码中没有感叹号。
I'm new to the Zend Framework and trying to figure some stuff out. I wonder if anyone could help me figure out why I'm unable to connect to a MYSQL database on my live server (a Cpanel / shared style webhost).
I've taken the following steps.
- Built the Zend framework
- Uploaded to a folder on the webhost
- Added the "ZEND" folder to the libraries
- Added the connect string stuff to the application.ini file *(a)
- Reloaded the page
*(a)
The connection information I've added goes like this:
resources.db.adapter = PDO_MYSQL
resources.db.params.host = localhost
resources.db.params.username = cpanel_dbuser
resources.db.params.password = 123456
resources.db.params.dbname = cpanel_db
the error I'm getting reads like
Fatal error: Uncaught exception 'Zend_Config_Exception' with message 'Error parsing /home/path/application/configs/application.ini on line 13 '
in /home/path/library/Zend/Config/Ini.php:181 Stack trace:
#0 /home/path/library/Zend/Config/Ini.php(201): Zend_Config_Ini->_parseIniFile('/home/path/...')
#1 /home/path/library/Zend/Config/Ini.php(125): Zend_Config_Ini->_loadIniFile('/home/path/...')
#2 /home/path/library/Zend/Application.php(383): Zend_Config_Ini->__construct('/home/path/...', 'production')
#3 /home/path/library/Zend/Application.php(85): Zend_Application->_loadConfig('/home/path/...')
#4 /home/path/public/index.php(25): Zend_Application->__construct('production', '/home/path/...')
#5 {main} thrown in /home/path/library/Zend/Config/Ini.php on line 18
EDIT
Line 13 of my application.ini is the password.
Which has an exclamation point in it.
Which if I change the password for the database user now works.
No exclamation points in Zend DB passwords.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
仅供参考 - 请不要费力地为我回答这个问题。
上面我已经回答了这个问题:
Zend DB 密码中没有感叹号。
我会删除这个问题,但为了其他人的利益,我想我应该把答案留在这里。 (搜索引擎可能会节省一些时间)
FYI - please don't struggle to answer this for me.
Up above I've already answered the question:
No exclamation points in Zend DB passwords.
I'd delete the question but for the sake of others' I thought I'd leave the answer here. (Search engines might save someone a bit of time)