PDO and ODBC to connect to SQL Server_php Tutorial

Source: Internet
Author: User
Tags sql server download vc9
PDO and ODBC to connect to SQL Server

Download the driver, I downloaded the 2.0, after downloading the release program, which has the following files:

PHP Tutorial _pdo_sqlsrv_52_nts.dll

Php_pdo_sqlsrv_52_ts.dll

Php_pdo_sqlsrv_53_nts_vc6.dll

Php_pdo_sqlsrv_53_nts_vc9.dll

Php_pdo_sqlsrv_53_ts_vc6.dll

Php_pdo_sqlsrv_53_ts_vc9.dll

Php_sqlsrv_52_nts.dll

Php_sqlsrv_52_ts.dll

Php_sqlsrv_53_nts_vc6.dll

Php_sqlsrv_53_nts_vc9.dll

Php_sqlsrv_53_ts_vc6.dll

Php_sqlsrv_53_ts_vc9.dll

Sqlserverdriverforphp.chm (manual, English good enough, can see, hehe)

Sqlserverdriverforphp_license.rtf

Sqlserverdriverforphp_readme.htm (Readme file)

Here is the contents of the Readme file, I translate:

Driver files
PHP version
Thread Safety
for PHP. dll

Php_sqlsrv_53_nts_vc6.dll

Php_pdo_sqlsrv_53_nts_vc6.dll
5.3
No
Php5.dll

Php_sqlsrv_53_nts_vc9.dll

Php_pdo_sqlsrv_53_nts_vc9.dll
5.3
No
Php5.dll

Php_sqlsrv_53_ts_vc6.dll

Php_pdo_sqlsrv_53_ts_vc6.dll
5.3
Yes
Php5ts.dll

Php_sqlsrv_53_ts_vc9.dll

Php_pdo_sqlsrv_53_ts_vc9.dll
5.3
Yes
Php5ts.dll

Php_sqlsrv_52_nts.dll

Php_pdo_sqlsrv_52_nts.dll
5.2
No
Php5.dll

Php_sqlsrv_52_ts.dll

Php_pdo_sqlsrv_52_ts.dll
5.2
Yes
Php5ts.dll

About the differences between VC6 and VC9, as well as non-thread-safe and thread-safe

The VC6 version is compiled with the Visual Studio 6 compiler, and if you are using apache+php under Windows, select the VC6 version.

The VC9 version is compiled with the Visual Studio 2008 compiler, and if you are using iis+php under Windows, select the VC9 version.

The Non thread safe is non-thread safe and does not perform thread security checks at execution time;

Thread safe is threaded, and thread security checks are performed to prevent new requirements from exhausting system resources by starting the CGI execution of new threads;


Start configuration


I use Apmserv built PHP environment (Apache 2.2.9+php 5.2.6+mysql 5.1.28), want to use thread-safe, so choose Php_sqlsrv_52_ts.dll and Php_pdo_sqlsrv_52_ Ts.dll.

To get started, copy the files to the Ext directory under the PHP folder, and then in the config file php.ini
Extensions after the following add:

; Extension=php_sqlsrv_52_ts.dll

; Extension=php_pdo_sqlsrv_52_ts.dll

Restart Apache again.

Finally test whether the success, look at Phpinfo's sqlsrv


This means that the connection is successful!! Get to work!

Connect to the Database tutorial

People who have used SQL Server should be aware that there are two authentication methods commonly used in SQL Server, one is Local System account authentication (Windows authentication), and one is using a user name and password (SQL Server Authentication ), the second authentication method must enable mixed mode for SQL Server.

1.Windows Authentication Connection Section code snippet


*/

$serverName = "(local)";
$connectionInfo = Array ("Database" = "test", "connectionpooling" =>false);
$conn = Sqlsrv_connect ($serverName, $connectionInfo);
if ($conn = = False)
{
echo "Connection failed! ";
Die (Print_r (Sqlsrv_errors (), true));
}

http://www.bkjia.com/PHPjc/630856.html www.bkjia.com true http://www.bkjia.com/PHPjc/630856.html techarticle PDO and ODBC to connect to the SQL Server download driver, I downloaded the 2.0, after downloading the release program installed, which has the following files: PHP tutorial _pdo_sqlsrv_52_nts.dll php_pdo_sqlsrv_52_ ...

  • 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.