简体   繁体   中英

This extension requires the Microsoft ODBC Driver 11 for SQL Server in PHP

I am trying to run a PHP develop application on my PC with MSSQL and this is the first time I am doing . I have already configured XAMPP on my PC and started Apache

Steps I did:

Downloaded sqlsrv32.exe

As my Php is

PHP Version 5.6.20

So i copied

extension=php_sqlsrv_56_ts.dll and
extension=php_pdo_sqlsrv_56_ts.dll

to my ext folder I have checked php.ini my extension folder is extension_dir="C:\\xampp\\php\\ext"

Also on phpinfo() i have

sqlsrv support enabled
Directive Local Value Master Value
sqlsrv.ClientBufferMaxKBSize 10240 10240
sqlsrv.LogSeverity 0 0
sqlsrv.LogSubsystems 0 0
sqlsrv.WarningsReturnAsErrors On On

Which meand its already installed, and my database.php file i have following code:

$serverName = "KASHIF\\SQLEXPRESS"; //serverName\instanceName

$connectionInfo = array( "Database"=>"RMS Delivery");
$conn = sqlsrv_connect( $serverName, $connectionInfo);

if( $conn ) {
 echo "Connection established.<br />";
}else{
 echo "Connection could not be established.<br />";
 die( print_r( sqlsrv_errors(), true));
}

However when I open my application on browser it says :

Connection could not be established. Array ( [0] => Array ( [0] => IMSSP [SQLSTATE] => IMSSP [1] => -49 [code] => -49 [2] => This extension requires the Microsoft ODBC Driver 11 for SQL Server. Access the following URL to download the ODBC Driver 11 for SQL Server for x86: http://go.microsoft.com/fwlink/?LinkId=163712 [message] => This extension requires the Microsoft ODBC Driver 11 for SQL Server. Access the following URL to download the ODBC Driver 11 for SQL Server for x86: http://go.microsoft.com/fwlink/?LinkId=163712 ) [1] => Array ( [0] => IM002 [SQLSTATE] => IM002 [1] => 0 [code] => 0 [2] => [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified [message] => [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified ) )

Then I downloaded ODBC Driver 11 for SQL Server , while installing it says :

Installation of this product failed because it is not supported on this oeprating system.

I already have SQL SERVER 2012 with Management Studio on my pc.

So please advice what I am leaving or what i am doing wrong .

Thanks

You can download pdo driver from here .

You will get all driver and help file too which is enough to solve your all query. I use php_pdo_sqlsrv_56_ts.dll driver for to my localhost.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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