【发布时间】:2018-04-30 15:32:15
【问题描述】:
我已经为此寻找解决方案几个小时了,我找到了很多解决方案,但不幸的是,它们都没有奏效。
我得到的错误是:
致命错误:未捕获的 PDOException:找不到驱动程序 C:\xampp\htdocs\site\includes\database\sqlsrv\database.inc:124 堆栈 跟踪:#0 C:\xampp\htdocs\site\includes\database\sqlsrv\database.inc(124): PDO->__construct('sqlsrv:Server=l...', 'sa', 'PWHERE...', Array) #1 C:\xampp\htdocs\site\includes\database\database.inc(1689): DatabaseConnection_sqlsrv->__construct(Array) #2 C:\xampp\htdocs\site\includes\database\database.inc(1479): 数据库::openConnection('xilenacc', 'default') #3 C:\xampp\htdocs\site\includes\database\database.inc(2350): 数据库::getConnection('default') #4 C:\xampp\htdocs\site\includes\lock.inc(167): db_query('SELECT expire, ...',数组)#5 C:\xampp\htdocs\site\includes\lock.inc(146): lock_may_be_available('schema:runtime:...') #6 C:\xampp\htdocs\site\includes\bootstrap.inc(433): lock_acquire('schema:runtime:...') #7 C:\xampp\htdocs\site\includes\bootstrap.inc(455): DrupalCacheArray->set(Array) #8【内部函数】: DrupalCacheArray->__destruct() #9 {main} 抛出 C:\xampp\htdocs\site\includes\database\sqlsrv\database.inc 上线 124`
这是 database.inc 的第 124 行:
PDO::__construct($dsn, $connection_options['username'], $connection_options['password'], $connection_options['pdo']);`
<br>
我正在使用的信息:
- PHP 版本:7.0.25
- Mssql 快递 2016
- Windows Server 2012
- 如果我能提供更多信息,请告诉我。
我尝试了什么:
- 从微软网站下载SQLSRV30并将扩展放入php -> 结果:将dll名称放入php.ini后,我重新启动apache并检查phpinfo(),我没有找到sqlsrv。
- 我仔细检查了 settings.php 中的信息 - 它们是正确的, 我什至尝试更改我的 sql pw,因为我认为它可能会导致这种情况, 但它没有用。
【问题讨论】:
-
您是否使用
msphpsql之类的工具来帮助PHP 与您的服务器和SQL 数据库通信? github.com/Microsoft/msphpsql -
不,我没有使用
msphpsql。 -
您是否正在使用任何东西让 PHP 与 MSSQL 对话? PDO_DBLIB
-
不,我也没有使用 PDO_DBLib。我没有使用任何东西让 PHP 与 MSSQL 对话..