WINDOWS2008R2 configuration php5.6+sqlserver2008 (X64) environment "Graphics Tutorial"

Source: Internet
Author: User
Tags microsoft drivers for php for sql server microsoft sql server microsoft website

Related theory

1. IIS supports a variety of ways to extend the language, and for IIS7 to execute PHP files by fastcgi Way

2. PHP through the "extension" in the configuration file, extended to support some features, but currently PHP itself no longer provide support for MS SQL Server components, fortunately Microsoft provided (but here is a big trap)

3. Microsoft provides PHP extension components that support access to MS SQL Server and require the support of visual Studio C + + redistributable, a Microsoft

4. Microsoft's MS SQL Server Native client is also needed as a driver

With the above inter-related, you can access MS SQL Server on a Windows server and in a iis+php environment.

Count several large pits

Pit 1: To access SQL Server 2008 R2, you need to install Microsoft SQL Server Native Client

Pit 2: Microsoft provides PHP components, only support 32 bits, that is, x86 platform, although PHP itself provides support for the x64 platform, but these two are not worthy of

Pit 3: If you must be in Windows Server 64bit (x64), PHP chooses x64, you cannot select IIS; the alternative is Apache, and the PHP SQL Server component requires a specially customized unofficial version; And the Apache official does not provide Windows version, to go to a third party to download

The pit 4:php has the TS, the NTS cent, also has the x86, the x64 cent; The Visual Studio C + + Redistributable has 2008, 2010, 2012, and 2015 points, as well as x86, x64, and different Visual Studio C + + The redistributable version corresponds to a different PHP version. One was careless, and it fell out of the pit.

version of the corresponding relationship:

1, select IIS, the PHP version must choose x86, NTS

2, PHP version number has vc* such content, and visual Studio C + + redistributable Corresponding relationship is: vc9-vs2008 SP1, vc11-vs2012, vc14-vs2015

If the PHP version chooses x86, then the visual Studio C + + redistributable must also be x86, otherwise you must select x64

Prepare items

1, IIS extension support fastcgi, the following figure, you must check the "CGI" option


Installation method one (recommended)

If the server has access to the Internet, it is recommended to choose a Web Platform Installer, but only 5.2.17 and 5.3.52 versions are optional.

1, open the URL: http://www.microsoft.com/web/platform/phponwindows.aspx


2, choose a good version, click on the corresponding button, enter the following interface, here to 5.3.5 version as an example


3, click "Install Now", you can download to obtain a PHP53.exe file, run, you can go to the following interface, click "Install"


4, here will be listed to install the components, click "I Accept"


5, the next is a long installation process, if the halfway failed, continue from the 3rd step, follow the same rhythm, until all installed successfully


After the installation is successful, you can see the specific installed components.


6, after the successful installation, you can use the PHP Manager to view the installation of the PHP path

Installation mode two (PHP Manager or manual)

1, install Microsoft SQL Server Native Client, installation files can go to Microsoft website download

2, download PHP package, be sure to select x86 and NTS, and extract files to the "Program Files (x86)" directory.

3, according to the VC version of the PHP package, install visual Studio C + + redistributable, please select the x86 version, vs version number, please refer to the corresponding relationship, installation files can go to Microsoft website download

4, go to Microsoft website download Microsoft Drivers for PHP for SQL Server, that is, PHP's SQL access component, execute the extracted DLL file

5, the PHP SQL Access components, according to the PHP version number of the NTS type of the DLL, copied to the PHP recorded ext subfolder

6, the recommended installation of PHP Manager, you can help faster configuration, installation files, please search yourself

7, start the IIS management tool, select "PHP Manager"


8, through the PHP Manager, through "Register New PHP Version", select the PHP directory Php-cgi.exe


9, start PHP Extensions, click "Enable or disabled an extension", start the expansion of PHP components, so you can start PHP access to SQL components


10, other PHP configuration items, suggest directly edit php.ini file, according to your actual situation, add the following:


[Webpichanges]
Error_log=c:\windows\temp\php53_errors.log
Upload_tmp_dir=c:\windows\temp
Session.save_path=c:\windows\temp
Cgi.force_redirect=0
Cgi.fix_pathinfo=1
Fastcgi.impersonate=1
Fastcgi.logging=0
max_execution_time=300
Date.timezone=asia/shanghai
Extension_dir= "C:\Program Files (x86) \php\v5.3\ext\"

[Extensionlist]
Extension=php_mysql.dll
Extension=php_mysqli.dll
Extension=php_mbstring.dll
Extension=php_gd2.dll
Extension=php_gettext.dll
Extension=php_curl.dll
Extension=php_exif.dll
Extension=php_xmlrpc.dll
Extension=php_openssl.dll
Extension=php_soap.dll
Extension=php_pdo_mysql.dll
Extension=php_pdo_sqlite.dll
Extension=php_imap.dll
Extension=php_tidy.dll

Extension=php_pdo_sqlsrv.dll

Extension=php_sqlsrv.dll


11, this time can start detection results, open phpinfo file, in the "registered PHP Streams", we can see sqlsrv, which means that PHP can access SQL Server.


At this point, we have successfully completed the environment configuration of Windows 2008 R2 x64 + IIS 7.0 + PHP 5.3.2 + SQL Server 2008 R2.

Of course, such an environment is actually running in a 32-bit x86 environment.

If you really want to run in a 64-bit x64 environment, you must be an environment configuration such as Windows 2008 R2 x64 + Apache 2.4 + PHP 5.3.2 + SQL Server 2008 R2, which will later be written back to the relevant records.


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.