Sir,

I am using wamp 3.0 having php 5.6.15
SQLSERVER 2008 is installed on Windows 7 32bit.

I want to connect sqlserver with php, So I put required drives in Bin folder as

aa.png

and made some necessary changes in php.ini as

bb.png

Finally I have this connection string

<?php
$host="SERVER";
$username="sa";
$password="123456";
$db_name="at17"; 
$con=sqlsrv_connect($host, $username, $password,$db_name);

if(!$con){
die ('<script type="text/javascript">alert("Error Connecting to host")'. mysqli_connect_error($con).'</script>'); 
}
else
{
//echo( '<script type="text/javascript">alert("Connected")</script>');
}
?>

But it displays this error message

cc.png

What I am doing wrong?

Please help me

I did this with the help of below links
Click Here
Click Here

Why did you still using this 'mysqli_connect_error' ?

I would assume that the SQL-Server extension is not loaded in PHP.

From the screenshots, the reason could be that you have all the
"extension=..." lines which are needed for SQL Server are in a subsection. The subsection starts according to your screenshot with [PHP_SQLSRV].

I would think that no extension lines are evaluated there.

Also do NOT include all of them. Thread safe (TS) and non thread safe (NTS) versions must match your PHP binary. So it must be one or the other.

Proposal: move two of the extension lines to the place where extensions are processed (You could move them directly below extension=php_xsl)

Use the following two:

  • php_sqlsrv.dll
  • php_sqlsrv_56_ts.dll (if your PHP is the thread safe version)
  • php_sqlsrv_56_nts.dll (if your PHP is the non thread safe version)

Restart your webserver. If it fails, post the content of the webserver error log.