PDOexception-'找不到驱动器' [英] PDOexception - 'could not find driver'

查看:104
本文介绍了PDOexception-'找不到驱动器'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我通过MAMP在本地站点上求爱.一切都进行到昨天.现在,当我运行我的代码时,我得到一个:致命错误:未捕获的异常'PDOException',并显示消息'找不到驱动器'..."看来我没有安装驱动程序,但直到今天仍能正常工作.我该如何解决这个问题?

I woork on my local site with MAMP. Everything was going right till yesterday. Now, when I run my code, I get a : "Fatal error: Uncaught exception 'PDOException' with message 'could not find driver'..." It seems that I have non installed driver but it worked well until this day. How can I fix this problem ?

最好, 纽本

推荐答案

我遇到了类似的问题. Sfblaauw的解决方案不起作用,但可以帮助我确定问题所在.首先,我使用MacPorts安装了php5-mysql:

I had a similar problem. Sfblaauw's solution didn't work but it helped me identify the problem. First I installed php5-mysql using MacPorts:

sudo port install php5-mysql

在安装过程中,我收到以下警告:

During installation, I got the following warning:

您的php.ini包含将阻止php5-mysql的行 和其他PHP扩展正常工作.要解决此问题, 编辑/opt/local/etc/php5/php.ini并删除以下行:

Your php.ini contains a line that will prevent php5-mysql and other PHP extensions from working. To fix this, edit /opt/local/etc/php5/php.ini and delete this line:

extension_dir ="/usr/lib/php/extensions/no-debug-non-zts-20090626"

extension_dir = "/usr/lib/php/extensions/no-debug-non-zts-20090626"

我注释掉了这一行,然后重新启动了Apache.现在一切似乎都正常了.

I commented out the line and restarted Apache. Everything seems to work fine now.

这篇关于PDOexception-'找不到驱动器'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆