PDO drivers no value in Windows

原创 2015年07月10日 10:14:32

学习php编程遇到 

Uncaught exception 'PDOException' with message 'could not find driver'  

或者 

Undefined class constant 'MYSQL_ATTR_INIT_COMMAND'

整两个问题,网上找了很多资料,很多是这样解决的


配置php.ini文件添加extension=php_pdo_mysql.dll,这样就开启pdomysql扩展库 

但是我没有解决问题,问题还是老样子,后来在stackoverflow 找到了问题所在

具体链接http://stackoverflow.com/questions/7086859/pdo-drivers-no-value-in-windows


问题出在了

extension_dir = "ext"
改成绝对路径就可以了
; Directory in which the loadable extensions (modules) reside.
; http://php.net/extension-dir
; extension_dir = "./"
; On windows:
extension_dir = "D:/php-5.4.11-Win32-VC9-x86/ext"

原因

in php.ini and php -m was starting fine and reporting that it loaded pdo_mysql, but when I ran phpinfo.php through apache, the driver was missing.

I fixed it by changing the extension_dir to an absolute path. I'm guessing it got confused when running through Apache and made it relative to something else.  

我固定它通过改变extension_dir绝对路径。我猜它混淆了运行时通过Apache和相对于别的东西。

版权声明:本文为博主原创文章,未经博主允许不得转载。

相关文章推荐

[KVM] Installing Virtio drivers in a KVM Windows guest VM

KVM provides a Virtio interface for the virtual hard disk and NIC. To use them in a Windows guest VM...

Square COO: There’s no value in NFC

The COO of mobile payment startup Square, Keith Rabois, thinks that the mobile payment technology Ne...

No. 33 - Maximums in Sliding Windows

No. 33 - Maximums in Sliding Windows Question: Given an array of numbers and a sliding window s...

转载:Setting Up ADB/USB Drivers for Android Devices in Linux (Ubuntu)

Setting Up ADB/USB Drivers for Android Devices in Linux (Ubuntu) Detail:http://esausilva.com/2010...

Writing device drivers in Linux: A brief tutorial(三)

“HelloWorld”驱动:在内核空间加载和卸载驱动          当一个设备驱动模块被加载进内核,一些诸如复位设备、预留RAM(reserving RAM)、中断和输入输出端口等预备工作经常...

Writing device drivers in Linux: A brief tutorial(五)

一个并口驱动程序:并行接口的描述          我将继续修改我之前创建的那个驱动程序从而使它可以在真正的设备上执行真正的任务。我将使用常见计算机的并口,并将这个驱动命名为“parleport” ...

Writing device drivers in Linux: A brief tutorial(一)

最近看到一篇国外关于Linux内核入门的比较好的指南,于是就尝试翻译了一下。由于是第一次尝试翻译,加之英语水平有限,错误在所难免,欢迎拍砖! 由于没有大段的时间来做这个,一下翻译完是肯定不可能的,故...

Writing device drivers in Linux: A brief tutorial

Writing device drivers in Linux: A brief tutorial

Writing device drivers in Linux: A brief tutorial (1)

“Do you pine for the nice days of Minix-1.1, when men were men and wrote their own device drivers?” ...

Linux Kernel Threads in Device Drivers

Purpose This examples shows how to create and stop a kernel thread. Thedriver is implemented as a ...
内容举报
返回顶部
收藏助手
不良信息举报
您举报文章:深度学习:神经网络中的前向传播和反向传播算法推导
举报原因:
原因补充:

(最多只允许输入30个字)