我最近开始学习PHP,而现在我正在努力的几件事是与MSSQLS数据库的连接。我在一些引用率很高的网站上了解到,将SQL DB与PHP一起使用的最常见(也是最佳)方法是使用PDO。
因此,这是我到目前为止所做的:
1-成功安装驱动程序:
extension=php_sqlsrv_55_ts.dll
extension=php_pdo_sqlsrv_55_ts.dll
(我已经签入phpinfo()
,并且我的PHP版本是线程安全的)
2-驱动程序在 phpinfo()
3-我不断收到此错误:
4 Uncaught exception 'PDOException' with message 'SQLSTATE[IMSSP]: This extension requires the Microsoft SQL Server 2012 Native Client ODBC Driver to communicate with SQL Server.
Access the following URL to download the Microsoft SQL Server 2012 Native Client ODBC driver for x86: http://go.microsoft.com/fwlink/?LinkId=163712' in C:\xampp\htdocs\catala4\testdb.php:4 Stack trace: #0 C:\xampp\htdocs\catala4\testdb.php(4): PDO->__construct('sqlsrv:Server=H...', 'USER', 'PASSWORD') #1 {main} thrown in C:\xampp\htdocs\catala4\testdb.php on line 4
执行此代码时:
<?php
include_once 'configs.php';
$mysqli = new PDO("sqlsrv:Server=HOST;Database=DATABASE", "USER", "PASSWORD");
我不知道出什么问题了,我想帮助解决这个问题,所以我的问题是:
使用PHP v 5.5.9
是的 。请阅读ODBC
错误的ODBC是中间件。
问题:未安装驱动程序。
解决方案: 下载并安装ODBC驱动程序。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句