简体   繁体   English

找不到驱动程序pdo_sqlsrv

[英]Cannot find driver pdo_sqlsrv

I am using Symfony 3.0, PHP 5.6.17 on Windows 7, with IIS 7.5 and a SQL Server Database (MSSQL). 我在Windows 7上使用Symfony 3.0,PHP 5.6.17,IIS 7.5和SQL Server数据库(MSSQL)。

Like a lot of people, I'm currently having the pdo_exception: 像很多人一样,我目前正在使用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 The two dll are properly named and located in the ext folder PHP.ini这两个DLL已正确命名并位于ext文件夹中

;extension=php_sqlsrv_56_nts.dll
extension=php_pdo_sqlsrv_56_nts.dll

I tried activating and deactivating php_sqlsrv_56_nts.dll without any difference. 我尝试激活和停用php_sqlsrv_56_nts.dll没有任何区别。

It looks, from phpinfo that the files are loaded: 它看起来,从phpinfo文件加载:

在此输入图像描述

Also, doing php -i I can see that it is enabled in command line also: 另外,做php -i我可以看到它在命令行中也启用了:

在此输入图像描述

Finally, here's what I have in Symfony's config file: 最后,这是我在Symfony的配置文件中的内容:

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

You must decomment first line : 您必须退出第一行:

extension=php_sqlsrv_56_nts.dll
extension=php_pdo_sqlsrv_56_nts.dll

Also : 另外:

  • restart IIS 重启IIS
  • app/console doctrine:cache:clear-metadata app / console doctrine:cache:clear-metadata
  • app/console doctrine:cache:clear-query app / console doctrine:cache:clear-query
  • app/console doctrine:cache:clear-result app / console doctrine:cache:clear-result
  • app/console cache:clear app / console cache:清除

Perhaps you can also read this : Topic StackOverflow for Doctrine MSSQL 也许您也可以阅读: Doctrine MSSQL的主题StackOverflow

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

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