How to connect to sql server from php (other computer) -
i have computer install sql server 2005
, other computer install xampp v3.2.1
i try connect sql server 2005 php in computer install xampp not working.
in computer install xampp do:
i download driver 3.0 php http://www.microsoft.com/en-us/download/details.aspx?id=20098
and copy 2 file php_sqlsrv_54_ts.dll
, php_pdo_sqlsrv_54_ts.dll
xampp\php\ext
and add code below php.ini
[sqlsrv] sqlsrv.logsubsystems=-1 sqlsrv.logseverity=-1 sqlsrv.warningsreturnaserrors=0 extension=php_sqlsrv_54_ts.dll extension=php_pdo_sqlsrv_54_ts.dll
i test connection
$servername = "nameserver"; $connectioninfo = array("database"=>"namedatabase"); $conn = sqlsrv_connect($servername, $connectioninfo); if ($conn) { echo "success"; }else { die (print_r(sqlsrv_errors(),true)); }
but error
array ( [0] => array ( [0] => imssp [sqlstate] => imssp [1] => -49 [code] => -49 [2] => extension requires microsoft sql server 2012 native client. access following url download microsoft sql server 2012 native client odbc driver x86: http://go.microsoft.com/fwlink/?linkid=163712 [message] => extension requires microsoft sql server 2012 native client. access following url download microsoft sql server 2012 native client odbc driver 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 , no default driver specified [message] => [microsoft][odbc driver manager] data source name not found , no default driver specified ) )
how connect sql server php. thanks
check error message says "this extension requires microsoft sql server 2012 native client." client piece of software install , can installer download microsoft.
i'm not sure if work on sql server 2005 though?
Comments
Post a Comment