php - Connecting to remote MS SQL database through SQLSRV driver -
php - Connecting to remote MS SQL database through SQLSRV driver -
i'm trying connect remote ms sql db (not localhost), everytime timeouts before sucseeds...
i'm pretty sure problem $servername variable, there anyway check via plesk parallels value of that?
<?php $servername = "server's ip address/database name"; //servername\instancename $connectioninfo = array( "database"=>"database name", "uid"=>"dbusername", "pwd"=>"dbpassword"); $conn = sqlsrv_connect( $servername, $connectioninfo); if( $conn ) { echo "connection established.<br />"; }else{ echo "connection not established.<br />"; die( print_r( sqlsrv_errors(), true)); } ?>
try inject precise port number servername
<?php $servername=127.0.0.1\sqlexpress,1433; //networkaddr\instancename,<portnum> ?>
try using ip address instead netbios name if do, cause icmp protocol blocked due security policy.
also, default port 1433 may blocked. should contact server administrator provide actual connection requisits in case.
php sql sql-server
Comments
Post a Comment