IIS7 Configure PHP Environment Complete tutorial

Source: Internet
Author: User
Tags install php iis php file thread vc9 zip

We know that there are several PHP configurations:

1, the CGI load PHP environment, is usually IIS inside the configuration interpreter for Php.exe, early more common, currently use less.

Characteristic is: stable, but the efficiency is too low.

2, ISAPI loading PHP environment, is usually IIS inside the configuration interpreter for Php5isapi.dll, currently used most, the most widely used.

Features are: multithreading, high efficiency, but not stable.

3, fastcgi way to load the PHP environment, in the IIS environment is not common, but other systems environment applications are still available, but IIS7.0 began to build the built-in fastcgi.

Features are: High efficiency, stability, belong to the future development trend.

I've tried other special problems, and the Windows version of PHP 5.3 doesn't support ISAPI mode anymore, so I'm going to run PHP in the fastcgi way recommended by Microsoft.

I use the third and best, because fastcgi greatly enhances the ability of IIS to handle PHP, and can quickly increase the response speed and productivity of the PHP site,

and has a higher stability and security.

Download Address: http://windows.php.net/download/

There are many kinds in it.

PHP now launches version 5.3.2, but there are several different versions to download. That's VC6 X86 and VC9 X86. First I will answer:

What is VC6?

VC6 is Legacy Visual Studio 6 compiler, which is compiled using this compiler.

What is VC9?

VC9 is the Visual Studio 2008 compiler, which is compiled with the Microsoft vs Editor.

So how do we choose which version of PHP to download?

If you are using apache+php under Windows, please select the VC6 version;

If you are using iis+php under Windows, please select the VC9 version;

So what's non Thread safe?

Non thread safe is not threaded;

What is Thread Safe?

Non thread safe is threaded;

FastCGI execution is done with a single thread, so there is no need for thread security checks, and removal of thread security checks can improve execution efficiency, so if you are executing PHP with FastCGI (regardless of IIS 6 or IIS 7), it is recommended that you download, execute Non-thread Safe PHP (PHP two has two packages: MSI, zip, download zip suite) So we chose No-thread Safe version of PHP to use.

Thread security checks are just for ISAPI PHP, because there are many PHP modules that are not thread-safe, so you need to use thread safe's PHP.

Download the installation, I install the default path:

Remember to select the third item: IIS FASTCGI

If the next step for IIS fastcgi is not installed, you will be prompted to download the installation.

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

After installation, continue to the next step, I follow the default:

After the installation is completed, it is configured.

There are two ways of this configuration, I use CMD configuration, a command on the line.

Go to the directory where you just installed the CGI:

>CD C:windowssystem32inetsrv

>cscript fcgiconfig.js-add-section: "PHP"-extension:php-path: "C:Program filesphpphp-cgi.exe"

Note: path: "Xxxxphp-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!

Under test:

Create a new. php file, Inside

Phpinfo ();

?>

Save!

Run, the following page appears, indicating that the configuration succeeded!

This way IIS does not have to configure, he will automatically configure the configuration! Microsoft offers more details!

If you run the PHP test page with the following tutorial configured, there are 500 errors.

Then set the Date.timezone item in the php.ini.

I set it to Shanghai time zone: Date.timezone = Asia/shanghai

After setting up, everything is OK!

Here are a few questions that need to be noted: (Problems I have encountered when I configure myself)

1. For the empty machine server, generally do not install any other database software, so we run the C:Program Filesphpphp-cgi.exe, whether there will be problems, and then solve the problem. (Try running with cmd)

Run C:Program Filesphpphp-cgi.exe, if you can enter the command window and only the cursor, indicating that fastcgi can normally call php-cgi, or you will be prompted to error, as shown

2. Run the test page to show 500 errors (I encountered a problem myself, and then found a solution on the internet.) )

Workaround:

Open IE----Internet option--------Advanced------------Show friendly HTTP error before the check out, and then the error will prompt you the wrong specific prompts.

Tips:

PHP Warning:Unknown:open (C:phpupload_tmpsess_li3ardp5qtalfj4, O_RDWR) Failed:permission denied (Unknown) in 0 PHP Warning:

Unknown:open (C:phpupload_tmpsess_li3ardbp5qtalfj4, O_RDWR) Failed:permission denied (Unknown) in the line 0 PHP warnin G:unknown:failed

To write session data (files). Please verify this current setting of Session.save_path is correct (c:phpupload_tmp) in Unknown on line 0

This means that I did not write permission to c:phpupload_tmp, given. Write permission, Resolve!

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.