找不到驱动程序pdo_sqlsrv [英] Cannot find driver pdo_sqlsrv

查看:817
本文介绍了找不到驱动程序pdo_sqlsrv的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Windows 7上使用Symfony 3.0,PHP 5.6.17,使用IIS 7.5和SQL Server数据库(MSSQL)。

I am using Symfony 3.0, PHP 5.6.17 on Windows 7, with IIS 7.5 and a SQL Server Database (MSSQL).

像很多人一样,我目前正在使用pdo_exception:

Like a lot of people, I'm currently having the pdo_exception:

  [Doctrine\DBAL\Exception\DriverException]
  An exception occured in driver: could not find driver



  [Doctrine\DBAL\Driver\PDOException]
  could not find driver



  [PDOException]
  could not find driver

但是,我不知道如何追踪错误。这就是我所拥有的:

However, I don't know how to trace the error. Here's what I have:

PHP.ini 这两个dll被正确命名并位于ext文件夹中

PHP.ini The two dll are properly named and located in the ext folder

;extension=php_sqlsrv_56_nts.dll
extension=php_pdo_sqlsrv_56_nts.dll

我尝试激活和停用 php_sqlsrv_56_nts.dll ,没有任何差别。

I tried activating and deactivating php_sqlsrv_56_nts.dll without any difference.

从phpinfo看,文件已加载:

It looks, from phpinfo that the files are loaded:

另外,执行 php -i 我可以看到它在命令行中也启用了:

Also, doing php -i I can see that it is enabled in command line also:

< a href =https://i.stack.imgur.com/dedaF.png =nofollow noreferrer>

最后,这是我在Symfony配置文件中的内容:

Finally, here's what I have in Symfony's config file:

doctrine:
    dbal:
        driver:   pdo_sqlsrv
        host:     "%database_host%"
        port:     "%database_port%"
        dbname:   "%database_name%"
        user:     "%database_user%"
        password: "%database_password%"

我真的不知道是什么再看一下。

I really don't know what to look into anymore.

推荐答案

在这段代码中你注意到:

in this code you notice :

;extension=php_sqlsrv_56_nts.dll
extension=php_pdo_sqlsrv_56_nts.dll

你必须退出第一行:

extension=php_sqlsrv_56_nts.dll
extension=php_pdo_sqlsrv_56_nts.dll

另外:


  • 重新启动IIS

  • app / console doctrine:cache:clear-metadata

  • app / console doctrine:cache:clear-query

  • app / console doctrine:cache:clear-result

  • app / console cache:clear

  • restart IIS
  • app/console doctrine:cache:clear-metadata
  • app/console doctrine:cache:clear-query
  • app/console doctrine:cache:clear-result
  • app/console cache:clear

Perha ps你也可以这样读: Doctrine MSSQL的主题StackOverflow

Perhaps you can also read this : Topic StackOverflow for Doctrine MSSQL

这篇关于找不到驱动程序pdo_sqlsrv的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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