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


and made some necessary changes in php.ini as


Finally I have this connection string

$con=sqlsrv_connect($host, $username, $password,$db_name);

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

But it displays this error message


What I am doing wrong?

Please help me

Recommended Answers

All 2 Replies

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.