"Blog begins" Server configuration: windows2008r2+php5.6+sqlserver2008 (X64)

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

Now popular lamp, if you choose Windows Server, then generally choose Iis+asp.net+sql Server (can be referred to as WINS), these configuration is very convenient.

But there are some special server configuration, for example: Windows R2 x64 + IIS 7 + PHP + SQL Server R2 x64 (abbreviated as WIPS), will be the same as PHP, originally thought very simple thing, the results toss a few genius to fix 。

In order to give other people a little warning, close-up this article.

Related theories

1. IIS supports a variety of ways to extend the language, and for IIS7, PHP files are executed fastcgi way

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

3. Microsoft provides PHP extension components, support access to MS SQL Server, requires visual Studio C + + redistributable Support, this Microsoft also provides

4. Microsoft's MS SQL Server Native Client is also required as a driver

Through the above tied up, can be implemented on the Windows Server, in the iis+php environment, access to MS SQL Server.

Count several pits

Pit 1: Access SQL server R2, need to install Microsoft SQL Server Native Client

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

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

Pit 4:php have TS, nts points, and x86, x64 of the points; visual Studio C + + Redistributable has 2008, 2010, 2012, 2015 points, and there are x86, x64 points, different visual The Studio C + + redistributable version corresponds to a different PHP version. One careless, it fell into the pit.

Version Correspondence Relationship:

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

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

The PHP version chooses x86, the visual Studio C + + redistributable must also be x86, and conversely, you must select x64

Prepare items

1, IIS extension support fastcgi, for example, must check the "CGI" option

Installation method one (recommended)

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

1. Open URL: http://www.microsoft.com/web/platform/phponwindows.aspx

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

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

4. The components to be installed are listed here, click "I Accept"

5, the next is a lengthy installation process, if the middle of failure, continue to start from the 3rd step, follow the same rhythm once, until all the installation success

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

6. After successful installation, the PHP Manager can be used to view the PHP path after installation.

Installation Method II (PHP Manager or manual)

1. Install Microsoft SQL Server Native Client, install file can go to Microsoft official website to download

2, download PHP package, must choose x86 and NTS, and unzip the file to "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 official website to download

4, go to Microsoft official website download Microsoft Drivers for PHP for SQL Server, that is, SQL access component of PHP, execute extract DLL file

5, the PHP SQL Access component, according to the PHP version number to pick out the NTS type of DLL, copied to PHP recorded in the Ext subfolder

6, the recommended installation of PHP Manager, can assist the faster configuration, installation files please search by yourself

7. Start the IIS Admin tool and select "PHP Manager"

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

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

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

[Webpichanges]Error_log=c:\windows\temp\php53_errors.LogUpload_tmp_dir=c:\windows\tempsession. Save_path=c:\windows\tempcgi. force_redirect=0CGI. fix_pathinfo=1fastcgi. impersonate=1fastcgi. logging=0Max_execution_time=300Date. timezone=asia/Shanghaiextension_dir="C:\Program Files (x86) \php\v5.3\ext\ "[Extensionlist]extension=php_mysql.dllextension=php_mysqli.dllextension =php_mbstring.dllextension=php_gd2.dllextension=php_gettext.dllextension=php_curl.dllextension=php_ Exif.dllextension=php_xmlrpc.dllextension=php_openssl.dllextension=php_soap.dllextension=php_pdo_ Mysql.dllextension=php_pdo_sqlite.dllextension=php_imap.dllextension=php_tidy.dllextension=php_pdo_ Sqlsrv.dllextension=php_sqlsrv.dll

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

So far, we have successfully completed the environment configuration of Windows R2 x64 + IIS 7.0 + PHP 5.3.2 + SQL Server R2 x64.

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

If you really want to run in a 64-bit x64 environment, you must be a Windows R2 x64 + Apache 2.4 + PHP 5.3.2 + SQL Server R2 x64 Such environment configuration, this later to write the related records.

"Blog begins" Server configuration: windows2008r2+php5.6+sqlserver2008 (X64)

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.