Most of PHP developer very much familiar with MySQL Database but We talk about Microsoft SQL Server we find lack for knowledge on PHP with SQL Server even on the google and php.net official website. Even the hosting company provide Pre-installed PHP and MySQL on the Server. Here some explicit instructions for install Microsoft SQLServ Driver in WAMP 32bit with PHP 5.3 :
1. Open http://www.microsoft.com/en-us/download/details.aspx?id=20098 for Download Microsoft SQLServ PHP Driver
2. Download SQLSRV30.EXE (Windows Vista, Server 2008, Windows 7 or above) or SQLSRV20.EXE (Server 2003/Windows XP or below).
3. Run SQLSRV30.EXE and enter your PHP bin folder path to Install Driver DLL files.
4. Open php.ini file and enable php sqlserv extensions
1. Open http://www.microsoft.com/en-us/download/details.aspx?id=20098 for Download Microsoft SQLServ PHP Driver
2. Download SQLSRV30.EXE (Windows Vista, Server 2008, Windows 7 or above) or SQLSRV20.EXE (Server 2003/Windows XP or below).
3. Run SQLSRV30.EXE and enter your PHP bin folder path to Install Driver DLL files.
4. Open php.ini file and enable php sqlserv extensions
extension=php_pdo_sqlsrv_53_ts.dll extension=php_sqlsrv_53_ts.dll
5. Restart All services in Wamp and confirm pdo_sqlsrv extension enable in phpinfo
6. Put you database connection string detail and User below php code to check database connection.
<?php $serverName = "hostname or ip"; $connInfo = array("Database"=>"db_name", "UID"=>"db_username", "PWD"=>"db_password"); $conn = sqlsrv_connect($serverName, $connInfo); if($conn){ echo "Database connection established.<br />"; }else{ echo "Connection could not be established.<br />"; die( print_r(sqlsrv_errors(), true)); } ?>
If you find any problem or difficulty, please fill free to contact us on info@ezeelive.com or leave a comment
Comments
Post a Comment