简体   繁体   English

PHP - 如何安装PDO驱动? (视窗)

[英]PHP - How to install PDO driver? (Windows)

I am setting up PHP and MySQL (Maria DB) on Windows 8.1.我正在 Windows 8.1 上设置 PHP 和 MySQL (Maria DB)。 I edited php.ini file and uncommented the following lines:我编辑了 php.ini 文件并取消注释以下行:

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

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:但不幸的是我无法连接到数据库,因为 phpinfo output 中没有显示 pdo 驱动程序。因此,当我尝试建立数据库连接时,抛出异常:

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

How can this problem be solved?如何解决这个问题?

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.ini 文件中的 extension_dir 条目(需要绝对文件路径),数据库连接开始工作。

查看你当前apache目录的extension_dir,我安装了2个php版本和apache,问题出在wamp\\bin\\apache\\Apache2.4.23\\bin\\php.ini,ext路径不对

In the php.ini file, just below;On Windows, uncomment 'extension_dir = "ext"'在 php.ini 文件中,就在下方;在 Windows 上,取消注释 'extension_dir = "ext"'

It worked for me.它对我有用。 php 片段截图

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM