Php – configure wamp to connect ms sql server 2008

PHPsql serverwamp

I have never connect PHP to MS sql server so getting confusion and trouble for configuring wamp to connect with sql server by following online tutorial. I have install wamp that consist of Apache Version 2.2.21 and PHP Version 5.3.8 and MS Sql server 2008 on same machine.
I downloaded the Microsoft Drivers for PHP for SQL Server(SQLSRV20.EXE). and extracted the file to D:\wamp\bin\php\php5.3.8\ext. Then I opened the php.ini file from wamp icon tray and provide the extension path as extension=php_sqlsrv_53_ts_vc9.dll and extension=php_sqlsrv_53_nts_vc9.dll.
I have put php file name testsqlserver.php in www root folder of wamp which code is shown below:

<?php
   $server = 'mypc/SQLEXPRESS';
   $link = mssql_connect($server,'sa','password');
   if(!$link)
   {
      die('something went wrong');
   }
?>       

When I called testsqlserver.php through browser as localhost:8080\testsqlserver.php. It shows the error:
Fatal error: Call to undefined function mssql_connect() in D:\wamp\www\connectsqlserver.php

am I doing wrong way? or is there anything more to do for this.I have gone through different online search but unable to get the exact solution for this. Would someone help me, it would be great appreciation

Best Answer

You have to edit your php.ini file located within the WAMP directory. There should be a few lines in there for loading the MS SQL extension but they are commented out; all you need to do is uncomment those lines and restart Apache.

I'm using XAMPP and the lines within my php.ini that I have to uncomment are:

;extension=php_mssql.dll

;extension=php_pdo_mssql.dll