Hi,
Could someone help us resolve the issue, thank in advance? We are using php 7, sql server 2008 r2 on windows server 2008 r2 sp1, iis 7.5.
The issue is we are upgrading code to work with php 7, earlier there was mssql_connect and mssql_* functions that were working so far but not anymore on php 7. So we are now trying to make similar function sqlsrv_connect and sqlsrv_* to work, it does not work
at the moment we are stuck with this error dump. Please notice that we have already installed the Microsoft ODBC Driver as mentioned in the error message but still we receive the same error.
Here is testcode:
$serverName = "serverName"; $dbusername = "dbusername"; $dbpassword = "dbpassword"; $dbname = 'dbname'; $connectionInfo = array( "Database"=>$dbname, "UID"=>$dbusername, "PWD"=>$dbpassword); $link = sqlsrv_connect( $serverName, $connectionInfo); if( $link !== false ) { echo "Connection established.".PHP_EOL; } else{ die( print_r( sqlsrv_errors(), true)); }
Here is error message:
Array( [0] => Array ( [0] => IMSSP [SQLSTATE] => IMSSP [1] => -49 [code] => -49 [2] => This extension requires the Microsoft ODBC Driver 11 or 13 for SQL Server. Access the following URL to download the ODBC Driver 11 or 13 for SQL Server for x64: http://go.microsoft.com/fwlink/?LinkId=163712 [message] => This extension requires the Microsoft ODBC Driver 11 or 13 for SQL Server. Access the following URL to download the ODBC Driver 11 or 13 for SQL Server for x64: 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 ) )
Here is screenshot of odbc datasource:
https://i.stack.imgur.com/PoQAK.png
Here are screenshots of php config
sqlsrv config
https://i.stack.imgur.com/4BEpm.png
odbc conf
https://i.stack.imgur.com/zsShM.png
pdo
https://i.stack.imgur.com/f1P9r.png
One more thing, if we need to install odbc drivers anyways why should one bother with Microsoft drivers. Is there anythnig I am missing?