我正在 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 驱动程序?(视窗)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!
MySQLi准备好的语句&foreach 循环MySQLi prepared statement amp; foreach loop(MySQLi准备好的语句amp;foreach 循环)
mysqli_insert_id() 是从整个服务器还是从同一用户获Is mysqli_insert_id() gets record from whole server or from same user?(mysqli_insert_id() 是从整个服务器还是从同一用户获取记录?)
PHP MySQLi 无法识别登录信息PHP MySQLi doesn#39;t recognize login info(PHP MySQLi 无法识别登录信息)
mysqli_select_db() 需要 2 个参数mysqli_select_db() expects exactly 2 parameters(mysqli_select_db() 需要 2 个参数)
Php mysql pdo 查询:用查询结果填充变量Php mysql pdo query: fill up variable with query result(Php mysql pdo 查询:用查询结果填充变量)
MySQLI 28000/1045 用户“root"@“localhost"的访问MySQLI 28000/1045 Access denied for user #39;root#39;@#39;localhost#39;(MySQLI 28000/1045 用户“root@“localhost的访问被拒绝)