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

转载:http://blog.csdn.net/bao0682/article/details/46827111

最新文章

  1. gulp 自动添加版本号
  2. 双向数据绑定(angular,vue)
  3. Codeforces Round #388 (Div. 2) - C
  4. Java(五)
  5. HTTP权威协议笔记-7.缓存
  6. Storm之spout,bolt编写
  7. vs2010制作带卸载功能的安装包过程,及asp.net网站iis发布、备份数据库
  8. orcherd 汉化
  9. Kibana4学习<一>
  10. Composer的使用
  11. Mac 域名解析
  12. C / C++算法学习笔记(7)-双向冒泡
  13. mysql中exists的用法介绍
  14. c# datetime与 timeStamp(unix时间戳) 互相转换
  15. MySQL日志专题
  16. TFT1.44显示屏
  17. [转] Java接口_interface_implements
  18. tomcat启动超时_tomcat was unable to start within
  19. js之操作cookie
  20. 3D屏保: 彩色盘子

热门文章

  1. 解决Linux关闭终端(关闭SSH等)后运行的程序或者服务自动停止【后台运行程序】
  2. 倍福TwinCAT(贝福Beckhoff)常见问题(FAQ)-人机界面如何快速调整大量控件的位置
  3. ThreadLocal的简单使用(读书笔记)
  4. Pinterest架构:两年内月PV从零到百亿
  5. Charles 抓HTTPS包报以下错误:
  6. C++11 Lambda表达式简单解析
  7. Vue 过滤器filters
  8. Odoo8中“更多”下拉菜单选项指定后台执行代码
  9. Android Exception18(Stuido debug .....)
  10. asp.net+mvc+easyui+sqlite 简单用户系统学习之旅(七)—— 添加用户到数据库-obj转json