I Have a big problem And I Wish get Solved for this problem here I Try to Connect to Sql Server 2008 R2 using:
- php 5.6.11
- Xampp 5.6.3
- Sql Server 2008 r2
- Using sql server drivers for PHP (php_pdo_sqlsrv_56_ts.dl & php_sqlsrv_56_ts.dll)
and my code to try connection is :
$serverName = "Mahmoud-HP\SQL2008R2"; //serverName\instanceName
$connectionInfo = array( "Database"=>"HR16", "UID"=>"Mahmoud", "PWD"=>"123" , "MultipleActiveResultSets" => false);
$conn = sqlsrv_connect( $serverName, $connectionInfo);
if( $conn ) {
echo "Connection established.<br />";
}else{
echo "Connection could not be established.<br />";
die( print_r( sqlsrv_errors(), true));
}
but when run the page this message come to me
Fatal error: Call to undefined function sqlsrv_connect() in C:\xampp\htdocs\testsqlserver\index.php on
What is solution for this problem
phpinfo(). That should show you if your SQL server drivers are correctly being loaded.php -vshould trigger them.<?php phpinfo();in it, save it asC:\xampp\htdocs\testsqlserver\phpinfo.phpand then load it in your browser (it should be the same URL you are already using, except that ending withphpinfo.php).