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和相对于别的东西。

dataTable和select2使用过程中的一些问题

最近写前端,用到了dataTable和select2.之前也用过,但是遇到问题都是绕过去,很少使用插件提供的方法来解决.今天把开发过程中遇到的问题记录一下. 1.首先是datable的ajax传参...

select自定义属性值

select自定义属性值1、问题背景     下拉框可以传递值和内容,不过有时为了传值,还需要连带其他的值也一起传过来;如果用title属性,鼠标移到下拉框上方会显示出来,这样就会导致被暴露出来。所以...

[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...

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?” ...
  • bitwei
  • bitwei
  • 2011年03月15日 11:36
  • 244

Linux Kernel Threads in Device Drivers

Purpose This examples shows how to create and stop a kernel thread. Thedriver is implemented as a ...

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

一个名为”memory”的完整的驱动:驱动的初始化部分          现在我将要演示如何建立一个完整的设备驱动:memory.c。这个驱动允许从它读取一个字符或者向它写入一个字符。尽管在正常情况...

转载: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)、中断和输入输出端口等预备工作经常...
内容举报
返回顶部
收藏助手
不良信息举报
您举报文章:PDO drivers no value in Windows
举报原因:
原因补充:

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