PHP Connect SQL Server Insights (the most complete in history)

Source: Internet
Author: User
Tags php website microsoft website
Category: PHP Time: May 20, 2016

First of all, why do you want to write "PHP Connect SQL Server experience (the most complete)" this article? First, this kind of problem PHP programmer seldom use, basically is php+mysql, second, encounter the problem online many are duplicate content, and can't solve the problem completely. In general, is the PHP connection to SQL Server may encounter problems and PHP programmer Rechesson The solution of the ideas are summed up to share to everyone, you want to use PHP to connect to SQL Server when you directly use it.

PHP programmer Rechesson uses PHP to connect to SQL Server environment: windows2008 64-bit system, PHP integrated Environment Wamp (software version includes apache2.4.9,mysql5.6.17,php5.5.12). By the way, in PHP programmer Rechesson's personal blog There are two articles about PHP and SQL Server, interested can look at Linux under the PHP extension MSSQL installation and thinkphp operation MSSQL experience.

Before PHP5.3 can also use MSSQL series functions, PHP website MSSQL introduction hint in PHP 5.3 or later version of Windows this extension is not available, after PHP7.0.0 MSSQL This feature was deleted, using Pdo_sqlsrv ( Windows only), PDO_ODBC, SQLSRV (Windows only), Unified ODBC API extension overrides. So in Windows systems, PHP connects SQL Server only to PDO_SQLSRV (Windows only) and SQLSRV (Windows only).

1, the introduction of PHP extension must pay attention to the version of PHP, TS or NTS, please refer to PHP programmer Rechesson's Blog "PHP version of the differences and usage of the detailed."

2. If the version of Microsoft PHP Driver is 3.1 or 3.2, you will need to download Microsoft ODBC Driver one for SQL Server on Microsoft website first.

3, Microsoft provides PHP extension sqlsrv and pdo_sqlsrv PHP only support 32-bit, that is x86 platform, does not support 64-bit, if you need to install 64 PHP extension you have to use unofficial sqlsvr and pdo_sqlsrv extension, 32-bit can be directly to the Microsoft official website to download. PHP extensions sqlsrv and pdo_sqlsrv download unofficial 32-bit and 64-bit addresses, 32-bit support for 5.3, 5.4, 5.5, 5.6, 64-bit support for 5.5, 5.6.

4, after installing the sqlsvr extension, open phpinfo () to see if there are sqlsvr and pdo_sqlsrv, note if you run with the command line, be sure to configure the primary profile. Command: Php.exe-c php.ini-f file.php.

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