Configure the PHP environment in IIS (quick and Latest Version)

Source: Internet
Author: User
Tags vc9

Today, we have a small web that needs to run in a PHP environment. It has worked hard to configure it! Finally, the following information is displayed:

We know several PHP configurations:

1. cgi PHP environment. Generally, php.exe is used as the interpreter in iis.
Features: stability, but low efficiency.

2. The ISAPI method is used to load the PHP environment. The configuration interpreter in IIS is php5isapi. dll, which is currently the most widely used and widely used.
Features: multithreading, high efficiency, but not stable enough.

3. FastCGI loading PHP environment is not common in the IIS environment, but there are still some applications in other system environments, but iis7.0 has started to build FastCGI.
Features:High efficiency and high stability are future development trends.

I have tried other problems. The windows version released by PHP 5.3 does not support the ISAPI mode, so I plan to run php In the FastCGI mode recommended by Microsoft.

I use the third method, which is also the best and fastest, becauseFastCGI greatly enhances IIS's ability to process PHP and can quickly improve the response speed and productivity of PHP sites,

And has higher stability and security.

: Http://windows.php.net/download/there are many types in it. What about that?

PHP version 5.3.2 is now available, but there are several different versions to download. That is, vc6 x86 and vc9 x86.
First, let me answer:
What is vc6?
Vc6 is compiled by the legacy Visual Studio 6 compiler.
What is vc9?
Vc9 is the Visual Studio 2008 compiler, which is compiled by Microsoft vs editor.

So how do we choose which PHP version to download?
If you are using Apache + PHP in windows, select vc6;
If you areIf IIS + PHP is used in windows, select vc9;

What is non thread safe?
Non-thread safe is non-thread security;
What is thread safe?
Non thread safe is thread security;

FastCGI executes operations in a single thread, so it does not need to perform thread security checks. Apart from the thread security check protection, it can improve the execution efficiency, if you use FastCGI (whether with IIS 6 or IIS 7) to execute PHP, we recommend that you download and execute non-thread safe PHP (the PHP binary path has two packet encoding methods: msi, zip, please unzip the zip package) So weUse PHP of No-thread safe version.
The thread security check is prepared for PHP in the ISAPI mode. Because many PHP modules are NOT thread-safe, thread safe PHP is required.

 

Download and install. The default installation path is:

Remember to select the third item:IIS FastCGI

If you do not install IIS FastCGI, you will be prompted if it is not installed. Download and install it.

FastCGI for IIS 6 7 http://www.iis.net/expand/fastcgi

After installation, continue to the next step. I followed the default settings:

After the installation is complete, the configuration is complete.

There are two methods for this configuration. I can configure it with cmd, just a command.

 

 

 

Go to the CGI installation directory:

> Cd c: \ windows \ system32 \ inetsrv

> Cscript fcgiconfig. js-add-Section: "php"-Extension: PHP-path: "C: \ Program Files \ PHP \ php-cgi.exe"

Note: Path: "XXXX \ php-cgi.exe" is the directory where you install PHP

> Cscript fcgiconfig. js-set-Section: "php"-instancemaxrequests: 10000
> Cscript fcgiconfig. js-set-Section: "php"-environmentvars: php_fcgi_max_requests: 10000

OK! Finished!

Test:

Create a. php file.

<? PHP

Phpinfo ();

?>

Save!

Run. The following page is displayed, indicating that the configuration is successful!

This method does not need to be configured in IIS. It will be automatically configured! Configuration provided by Microsoft is more detailed!

If the PHP test page is run after the configuration is completed according to the above tutorial, Error 500 is displayed.

Set the date. timezone item in PHP. ini.

Set it to Shanghai Time Zone: Date. timezone = Asia/Beijing

After the settings are complete, everything is normal!

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.