如何在Windows上为PHP安装PDO驱动程序? [英] How do I install PDO drivers for PHP on Windows?

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

问题描述

我在Windows服务器上安装了Apache,PHP 5.6和MySQL 5.7.

I installed Apache, PHP 5.6 and MySQL 5.7 on a Windows server.

在php.ini中,我启用了以下功能:

In php.ini, I enabled the following:

extension=php_mysql.dll
extension=php_mysqli.dll
extension=php_oci8_12c.dll
extension=php_pdo_mysql.dll
extension=php_pdo_oci.dll

(然后重新启动Apache)

(And restarted Apache)

但是当我尝试在我的php页面中使用PDO时,它仍然会引发错误:

But when I try to use PDO in my php page, it still throws the error:

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

要安装PDO,我该怎么做?

What do I have to do to get PDO installed?

推荐答案

问题是extension_dir指令不能用作相对路径.从extension_dir="ext"更改为extension_dir="c:/phpinstall_path/ext"可以解决此问题.

The problem was the extension_dir directive did not work as a relative path. Changing from extension_dir="ext" to extension_dir="c:/phpinstall_path/ext" fixed the problem.

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

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