Search code examples
phpsql-serverwampwampserver

Connecting to database on SQL server from WAMPSERVER 2.5


I've got a WAMPSERVER 2.5 development server. It's running PHP 5.512.

I'm trying to connect to our live SQL Server. I've installed and activated the version 32 files, and used the following code:

<?php 

$link = sqlsrv_connect('obscured_ip:obscured_port', array('Database'=>'obscured_database','UID'=>'obscured_uid', 'PWD'=>'obscured pwd'));

if (!$link)
    die(print_r(sqlsrv_errors(), true));

?>

I'm getting the following error:

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 ) )

The link specified there just takes me back to the driver download page. What am I doing wrong?


Solution

  • The URL in the error points to the wrong page. This is the correct one: https://www.microsoft.com/en-us/download/details.aspx?id=36434