PHP (v5.5.15) Access SQLServer2014 in XAMPP (v1.83)

Source: Internet
Author: User

driver Installation:

1. Download Microsoft official PHP driver for SQL Server, http://msdn.microsoft.com/en-us/sqlserver/ff657782.aspx

2. Install the SQLSRV31. EXE file, that is, unzip3. Copy files (thread-safe)Php_pdo_sqlsrv_55_ts.dll and php_sqlsrv_55_ts.dll to \xampp\php\ext4. Modify the \xampp\php\php.ini file and add it under [PHP]Extension=php_pdo_sqlsrv_55_ts.dllExtension=php_sqlsrv_55_ts.dll5. Restart the computer (may not be required)  SQLSRV function Encoding Conversion : page encoding UTF-8method One: Specify a character set when connecting$conInfo =array (' Database ' = $database, ' UID ' + $uid, ' PWD ' + $pwd, ' CharacterSet ' = ' UTF-8')  ; $link =sqlsrv_connect ($serverName, $conInfo); method Two: Use Iconv manual conversion when accessingconverting encoding to GB2312 when writing to SQL Servericonv (' utf-8 ', ' Gb2312//ignore ', ' string to write to the database ');convert encoding to UTF-8 when reading SQL Server stringsiconv (' GB2312 ', ' utf-8//ignore ', ' Database return string '));  PDO function Encoding Conversion : Web page encoding UTF-8, no conversion required, Pdo::sqlsrv_encoding_utf8 for default encodingDatabase Connection Example:$c = new PDO ("Sqlsrv:server=localhost;database=testdb", "UserName", "Password");$c = new PDO ("Sqlsrv:server=localhost,1521;database=testdb", "UserName", "Password");connect to a MS SQL Server database on a specified port 1521.   and MySQL a lot slower than the speed

PHP (v5.5.15) Access SQLServer2014 in XAMPP (v1.83)

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.