PHP-如何安装PDO驱动程序? (视窗) [英] PHP - How to install PDO driver? (Windows)

查看:222
本文介绍了PHP-如何安装PDO驱动程序? (视窗)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在Windows 8.1上安装PHP和MySQL(Maria DB).我编辑了php.ini文件,并取消了以下几行的注释:

I am setting up PHP and MySQL (Maria DB) on Windows 8.1. I edited php.ini file and uncommented the following lines:

extension=php_mysql.dll
extension=php_mysqli.dll
extension=php_pdo_mysql.dll

但是不幸的是我无法连接到数据库,因为phpinfo输出中没有显示pdo驱动程序.因此,当我尝试建立数据库连接时,会引发异常:

But unfortunately I cannot connect to database because there are no pdo drivers shown in phpinfo output. So, when I try to establish database connection, an exception is thrown:

Fatal error: Uncaught exception 'PDOException' with message 'could not find driver'

如何解决这个问题?

推荐答案

最后,我设法解决了这些问题.我更正了php.ini文件中的extension_dir条目(需要绝对文件路径),并且数据库连接开始工作.

Finaly I managed to settle this stuff. I corrected extension_dir entry (absolute file path was needed) in php.ini file and database connection began to work.

这篇关于PHP-如何安装PDO驱动程序? (视窗)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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