Configure PHP Access Sqlsever in Wamp server

Source: Internet
Author: User
Tags sql server driver

Configure PHP Access Sqlsever in Wamp server

Most of the online introduction is right, the key points did not write, worried about the death of a person ah

1, Windows Server 2008 or R2 version, if it is 64-bit system also want to Ann Wamp server 32 bit, otherwise the driver is not good use ah, blood lesson AH

2. In the example below, php5.4 should be changed to Php_sqlsrv_54_ts.dll

3, php5.5 official No, there is a third party, website: http://www.hmelihkara.com/files/php_sqlsrv_55.rar

4, thinkphp to Sqlsever support Not very good, anyway feel pit more

The following article source URL: http://www.uncletoo.com/html/base/824.html

Install the Microsoft SQL Server driver in Wamp

Most PHP developers are very familiar with MySQL database , but for SQL Server, we find that even the official website of Google and Php.net have little knowledge about PHP and SQL Server. This article describes how to install the Microsoft Sqlserv driver on 32-bit WAMP and PHP5.3.

1. Open http://www.microsoft.com/en-us/download/details.aspx?id=20098 link to download Microsoft SQL Server PHP driver;

2. Download SQLSRV30.EXE (for Windows Vista,server 2008, and Windows 7 or above) or SQLSRV20.EXE (for Server 2003/windows XP or below).

3, run SQLSRV30.EXE, then enter your PHP Bin folder path, install the driver DLL file, such as:

4. Open the php.ini file and remove the semicolon (;) before the following two lines of code

Extension=php_pdo_sqlsrv_53_ts.dll

Extension=php_sqlsrv_53_ts.dll

5. Restart the Wamp service and use Phpinfo to see if the PDO_SQLSRV is enabled:

6. Create php file, copy and paste the code below, check the link between PHP and SQL Server Database

1 2 3 4 5 6 7 8 9 10 11 <?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)); } ?>

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.