Detailed steps for building the PHP environment, detailed steps for building the php Environment

Source: Internet
Author: User

Detailed steps for building the PHP environment, detailed steps for building the php Environment

Next, I will continue to talk about how to configure IIS to support php:

1, go to the php official website to download php: http://windows.php.net/download. For IIS7, We need to select the VC9 package above php 5.3 and download the zip file.


2. decompress the zip package to your selected directory, for example, C: \ PHP \.Decompress the PHP package and copy php. ini-production to the php. ini file in the same directory. Then modify the configuration file php. ini. Commands that must be modified:

Extension_dir = <path to the extension library directory>-Extension_dir must point to the directory where the PHP extension library files are stored. It can be an absolute path (such as "C: \ PHP \ ext") or a relative path (such as ". \ ext "). The extension libraries to be loaded in the php. ini file must be in the directory specified by extension_dir.

Extension = xxxxx. dll-For each extension to be activated, a corresponding "extension =" statement is required to describe which extensions under the extension_dir directory are loaded during PHP startup.

Log_errors = On-PHPAn error log can be used to send an error report to a file, or to system services (such as system logs ).

Error_logCommands work together. When running in IIS, log_errors should be activated and used with valid error_log.

Error_log = <path to the Error Log File>-Error_log must point to a file name with an absolute or relative path to record the PHP error log. The Web server must have the write permission on this file. The most common location is a variety of temporary directories, such as "C: \ inetpub \ temp \ php-errors.log ".

Cgi. force_redirect = 0-Disable this command when running in IIS. This is a directory security function that needs to be activated in many other web servers. However, activation in IIS may cause PHP engine errors in Windows.

Cgi. fix_pathinfo = 1-This command allows PHP to follow CGI rules to access real path information. The FastCGI Implementation of IIS needs to activate this command.

Fastcgi. impersonate = 1-FastCGI in IIS supports simulating the Security token of the caller. This allows IIS to define the security context of the requester.

Fastcgi. logging = 0-FastCGI logs should be disabled under IIS. If it is activated, any message of any class will be treated as an error condition by FastCGI, resulting in an HTTP 500 Error in IIS.

3. Configure the command for CGI-And FastCGI-in the php. ini file:

fastcgi.impersonate = 1 fastcgi.logging = 0 cgi.fix_pathinfo=1 cgi.force_redirect = 0 

4. Use the IIS management interface to create a PHP program ing:Select the handler ing --> operation on the right --> Add module ing --> Add php ing --> request restriction --> select "the handler is called only when the request is mapped to the following content (I): "--> select" file or folder (O) "--> OK --> OK. :




5. SET index. php as the default document in IIS.Select "Default document" --> Add --> edit index. php --> OK.


6. Add the index. php file for testing.

<?php  phpinfo();  ?> 

Save the file to the web and directory. Restart IIS and browse the index. php file. If the php information page appears, the environment is successfully set up. :


The above is the whole process of setting up IIS 7 and php servers. I hope it will help you learn more.

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.