Our web developer is getting the following error when trying to test a connection to SQL using PHP code:
Connection could not be established.
Array ( [0] => Array ( [0] => IMSSP [SQLSTATE] => IMSSP [1] => -49 [code] => -49 [2] => This extension requires the Microsoft SQL Server 2012 Native Client. Access the following URL to download the Microsoft SQL Server 2012 Native Client ODBC driver for x86: http://go.microsoft.com/fwlink/?LinkId=163712 [message] => This extension requires the Microsoft SQL Server 2012 Native Client. Access the following URL to download the Microsoft SQL Server 2012 Native Client ODBC driver 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 ) )
We are running Windows 2003 Standard 32-bit with SQL 2008. Here is the code he’s using for the connection:
<?php $serverName = "BALBOA\MSSQLSERVER"; $connectionInfo = array( "Database"=>"DSRASurvey", "UID"=>"sa", "PWD"=>"password"); $conn = sqlsrv_connect( $serverName, $connectionInfo); if( $conn ) { echo "Connection established."; }else{ echo "Connection could not be established.
"; die( print_r( sqlsrv_errors(), true)); } ?>
Here is the bottom of our php.ini file showing the extensions being loaded:
[WebPIChanges]
error_log=C:\WINDOWS\temp\php53_errors.log
upload_tmp_dir=C:\WINDOWS\temp
session.save_path=C:\WINDOWS\temp
cgi.force_redirect=0
cgi.fix_pathinfo=1
fastcgi.impersonate=1
fastcgi.logging=0
max_execution_time=300
date.timezone=America/Los_Angeles
extension_dir=“C:\Program Files\PHP\v5.3\ext”
[ExtensionList]
extension=php_mysql.dll
extension=php_mysqli.dll
extension=php_mbstring.dll
extension=php_gd2.dll
extension=php_gettext.dll
extension=php_curl.dll
extension=php_exif.dll
extension=php_xmlrpc.dll
extension=php_openssl.dll
extension=php_soap.dll
extension=php_pdo_mysql.dll
extension=php_pdo_sqlite.dll
extension=php_imap.dll
extension=php_tidy.dll
[PHP_WINCACHE]
extension=php_wincache.dll
extension=php_pdo_sqlsrv.dll
extension=php_sqlsrv.dll
[PHP_OAUTH]
extension=php_oauth.dll
[PHP_MSSQL]
extension=php_sqlsrv_53_nts_vc9.dll
[PHP_PDO_MSSQL]
extension=php_pdo_sqlsrv_53_nts_vc9.dll
Any idea why we’re getting a message asking for MS SQL 2012 ODBC when we are only running MS SQL 2008 on the server?
I’ve loaded the .dll files into the PHP ext folder that the MS KB article references but still no luck. Any ideas out there? Thanks in advance.[/code]