Home > Backend Development > PHP7 > body text

What is the method to connect sqlserver in php7

醉折花枝作酒筹
Release: 2023-02-18 07:48:01
forward
3555 people have browsed it

This article introduces how to connect php7 to Sqlserver. It mainly includes usage examples of php7.2 connecting to Sqlserver, application skills, summary of basic knowledge points and matters needing attention. It has certain reference value and friends in need can refer to it.

What is the method to connect sqlserver in php7

First of all, php needs to enable the sqlsrv extension

1. Download SQLSRV40.EXE (supports php7.0), https:// www.microsoft.com/en-us/download/details.aspx?id=20098

##2. Run SQLSRV40.EXE, Generate extension files, as shown in the figure

3. Copy php_pdo_sqlsrv_7_ts_x64.dll and php_sqlsrv_7_ts_x64.dll to the php/ext directory (my computer is 64-bit)

Note: For the difference between ts and nts, see phpinfo

4. Add

extension=php_pdo_sqlsrv_7_ts_x64.dll

to php.ini

extension=php_sqlsrv_7_ts_x64.dll

Open extension

##5. Install ODBC Driver 11 For SQL (msodbcsql.msi)

https://www.microsoft.com/en-us/download/details.aspx?id=36434

6. Run msodbcsql.msi to complete the installation

Note:

7. Restart apache, the sqlsrv extension is successfully opened

Note: The php7.1 version will not be successfully opened according to this method, the reason The two extension files php_pdo_sqlsrv_7_ts_x64.dll and php_sqlsrv_7_ts_x64.dll are not applicable to php7.1. Please search for these two extension files suitable for php7.1

Recommended learning:

php video tutorial

The above is the detailed content of What is the method to connect sqlserver in php7. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:csdn.net
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!