php5.6 Connecting to SQL SERVER

Source: Internet
Author: User
Tags phpinfo

PHP Fatal Error: Call to  undefined function sqlsrv_connect () inphp link SQL Server appears because: php5.3 and above have removed the previous link method, want to use , you need to use PDO or SQLSVR, plus the DLL extensions provided by Microsoft. Before on-line see have written to php5.5 link SQL SERVER, feel not enough detailed, so oneself write again a php5.6. Previously seen php5.5 tutorial http://blog.csdn.net/xocom/article/details/45840725 Microsoft Official website DLL does not support 64-bit, here is an unofficial version of the download link HTTP// download.csdn.net/detail/tan1103/8771927 download good after decompression, wherein the x64 folder is supported 64-bit system, we use the php5.6 version used to two files Php_sqlsrv_56_nts.dll  and Php_pdo_sqlsrv_56_nts.dll or
Php_sqlsrv_56_ts.dll  and Php_pdo_sqlsrv_56_ts.dll, that's TS? Or the NTS?


TS and NTS mean: thread-safe. and PHP version, with phpinfo (); View, print out phpinfo, find the thread Safety, if disabled is non-thread-safe, use NTS version;
If the Enable is the TS version, mine is NTS.


Then copy the corresponding version of the DLL files (my Php_sqlsrv_56_nts.dll and Php_pdo_sqlsrv_56_nts.dll) to Php5.6\ext (the folder where the extension is located, mostly under the PHP directory);
Then introduce the extension in php.ini, here is my reference path, D:\php5.6\ext\ is also the directory where the extension files

Extension=d:\php5.6\ext\php_sqlsrv_56_nts.dll
Extension=d:\php5.6\ext\php_pdo_sqlsrv_56_nts.dll
(My php.ini's Extension_dir is located to the C \ disk, so I need to use an absolute path reference, can also be modified to Extension_dir=ext, and then the relative path reference is also OK, such as extension=php_sqlsrv_56_ Nts.dll, most do not have to modify, anyway with absolute path quasi correct)
Finally restart the service (Apache restarts Apache,iis on restart IIS), OK.

Reprint: http://blog.csdn.net/qq_27396589/article/details/53374769

php5.6 Connecting to SQL SERVER

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.