php5.3.10 Connection sqlserver2005

Source: Internet
Author: User
Tags management studio sql server management sql server management studio

PHP connection to SQL Server is really frustrating. Engaged in the majority of days, finally connected to success, and now share to everyone!

One: Download and install: Sqlexpr_chs. Exe

: Click to download (Baidu Cloud) Http://pan.baidu.com/s/1pJLtdjX

After the download is complete, run the program and click "Next" to continue.

Two: Download and install: SQL Server Management Studio Express

: Click to download (Baidu Cloud) Http://pan.baidu.com/s/1mgLzlFi

After the download is complete, run the program and click "Next" to continue.

Three: Download the PDO file related to SQL Server

: Click to download (Baidu Cloud) Http://pan.baidu.com/s/1pJvACCN

After the download is complete, the decompression will see two files. As shown

IV: Add DLL files to the PHP extension

Unzip to get Php_pdo_sqlsrv_53_ts_vc9.dll and php_sqlsrv_53_ts_vc9.dll two files.

Below we need to add these two files to the PHP extension folder.

I am using Wampserver 2.2 integrated environment, extended folder in-c:\wamp\bin\php\php5.3.10\ext,

V: Change the php.ini file and restart Apache

Open the php.ini file, search for "PDO" and add the following code:

Extension=php_sqlsrv_53_ts_vc9.dll
Extension=php_pdo_sqlsrv_53_ts_vc9.dll

Once added, restart the Apache service. OK, get it done!

VI: Managing SQL Server

1: Start SQL Server Management Studio Express. Can be found, click Open.

After opening is the following interface, to get the Windows Authentication host name

You can manage SQL Server and perform database operations.

Seven: Use navicat for SQL Server to better manage

Download Navicat, click to download (Baidu Cloud) HTTP://PAN.BAIDU.COM/S/1EQEJRJK

Click OK, then connect, it is successful ~ can be used Navicat management, so much more convenient!

Eight: Testing

Open the php file, enter the following code, test it!

1 $serverName= "Xxyy-73\sqlexpress";//ServerName\InstanceName2 $connectionInfo=Array (3"Database" = "test"//DB name, create it Yourself4 );5 $conn= Sqlsrv_connect ($serverName,$connectionInfo );6 if(!$conn) {7     Echo"Connection could not being established.<br/>";8      die(Print_r(Sqlsrv_errors (),true ) );9}

Connection Successful!

php5.3.10 Connection sqlserver2005

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.