无法将 Zend 连接到 MySQL

发布于 2024-10-18 04:58:45 字数 1494 浏览 3 评论 0原文

我是 Zend Framework 的新手,正在尝试解决一些问题。我想知道是否有人可以帮助我弄清楚为什么我无法连接到我的实时服务器(Cpanel/共享式网络主机)上的 MYSQL 数据库。

我已采取以下步骤。

  1. 构建 Zend 框架
  2. 上传到 Web 主机上的文件夹
  3. 将“ZEND”文件夹添加到库中
  4. 将连接字符串内容添加到 application.ini 文件 *(a)
  5. 重新加载页面

*(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.

  1. Built the Zend framework
  2. Uploaded to a folder on the webhost
  3. Added the "ZEND" folder to the libraries
  4. Added the connect string stuff to the application.ini file *(a)
  5. 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

池木 2024-10-25 04:58:45

仅供参考 - 请不要费力地为我回答这个问题。

上面我已经回答了这个问题:

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)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文