Codeigniter MSSQL / SQLSRV连接 [英] Codeigniter MSSQL/SQLSRV Connection
问题描述
我正在开发一个连接到MSSQL数据库的网络应用。我以前设法成功连接到数据库,但是对sqlsrv_driver文件进行了较小的更改。我遇到以下错误,将更改回滚到原始文件,但是仍然存在问题。
I'm working on a web app that connects to a MSSQL database. I previously managed to connect to the database without any problems, however I made a minor change to the sqlsrv_driver file. I encountered the below error, rolled my changes back to the original file, but there are still issues.
我确保已安装了相关的MS驱动程序,正确的端口号使用,等等,但是它返回此错误:
I have ensured that I have relevant MS drivers installed, correct port number used, etc however its returning this error:
Unable to connect to your database server using the provided settings.
Filename: D:...\system\database\DB_driver.php
Line Number: 124
此外,我已经通过sqlsrv_connect函数在codeigniter外部建立了连接。
Further to this I have made a connection out side of codeigniter via the sqlsrv_connect function. Which a successful connection is made with no errors.
为什么会出现此错误?
推荐答案
要从PHP-> SQLSrv连接,您需要安装以下驱动程序:
For connection from PHP->SQLSrv you need install these drivers :
a。 用于SQL Server的PHP的Microsoft驱动程序3.0 (SQLSRV30。 EXE)
a. Microsoft Drivers 3.0 for PHP for SQL Server (SQLSRV30.EXE)
b。 Microsoft Visual C ++ 2010可再发行组件包(32位/ 64位)
c。 Microsoft®SQLServer®2012 Native Client (sqlncli。 msi)
c. Microsoft® SQL Server® 2012 Native Client (sqlncli.msi)
并将此行添加到php.ini文件中:
And add this row in php.ini file:
extension=php_sqlsrv_54_ts.dll
这篇关于Codeigniter MSSQL / SQLSRV连接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!