Security Basics-IIS6 PHP best configuration method

Source: Internet
Author: User
Tags sapi website server
Although the LAMP combination is good, if you want to set up a Web virtual host server that supports both PHP, ASP, ASP. NET, JSP, and Perl, it is still the best to use IIS6 of Windows2003. There are many articles on the Internet that allow you to configure PHP on IIS6, but these methods are either poor performance or difficult to upgrade. The following method allows you

Although the LAMP combination is good, if you want to set up a Web virtual host server that supports both PHP, ASP, ASP. NET, JSP, and Perl, Windows 2003 IIS 6 is the best. There are many articles on the Internet that allow you to configure PHP on IIS 6, but these methods are either poor performance or difficult to upgrade. The following method allows you to easily upgrade after the first configuration.

The upgrade mentioned here refers to upgrading from a php4 version to another php4 version, or from a php5 version to another php5 version, rather than from php4 to php5.

Preparation:

1. an installed Windows 2003 Server with IIS 6 installed.

2. download the PHP binary package for windows.

Installation:

Decompress the PHP binary package to the C: \ php Directory (assume that the C: disk is a system disk, that is, the Windows system disk is installed. if the system disk is a D: Disk, decompress it to D: \ php directory, and so on ).

Choose "My Computer"> "properties"> "advanced"> "environment variables"> "system variables"> "path" to compile the value, add the following path address:


C:\php;C:\php\dlls;C:\php\extensions;C:\php\sapi;
Set php. ini-dist or php. copy ini-recommended to the C: \ Windows directory and change it to php. ini, generally officially announced that the website server uses php. ini-dist, and php. ini-recommended is better. Of course, in general, this php. ini still needs to be corrected according to the actual situation.

Here are some necessary correction options:


extension_dir = 'C:\php\extensions'
This is the directory where PHP expands. make sure that the directory is the same as the Directory you actually installed.


extension=php_mbstring.dll;extension=php_big_int.dllextension=php_bz2.dllextension=php_cpdf.dllextension=php_crack.dllextension=php_curl.dllextension=php_db.dllextension=php_dba.dllextension=php_dbase.dllextension=php_dbx.dllextension=php_domxml.dll;extension=php_exif.dll;extension=php_fdf.dll;extension=php_filepro.dllextension=php_gd2.dllextension=php_gettext.dllextension=php_hyperwave.dllextension=php_iconv.dll;extension=php_ifx.dll;extension=php_iisfunc.dllextension=php_imap.dll;extension=php_interbase.dllextension=php_java.dllextension=php_ldap.dll;extension=php_mcrypt.dllextension=php_mhash.dllextension=php_mime_magic.dllextension=php_ming.dllextension=php_mssql.dllextension=php_msql.dll;extension=php_oci8.dllextension=php_openssl.dll;extension=php_oracle.dllextension=php_pdf.dllextension=php_pgsql.dll;extension=php_printer.dllextension=php_shmop.dll;extension=php_snmp.dllextension=php_sockets.dll;extension=php_sybase_ct.dllextension=php_w32api.dllextension=php_xmlrpc.dllextension=php_xslt.dllextension=php_yaz.dllextension=php_zip.dll


In the above cases, the expansion of opening is not a plus sign, and the expansion without opening is added with a semicolon. The above settings include all extensions that can be enabled by default during Windows 2003 installation (php 4 is listed here ).


session.save_path = c:\sessions

This is the default session file directory, which must be an existing directory. Otherwise, the default session function will be ineffective. Here I set a directory on a ramdisk. Setting session. save_path on ramdisk can speed up session processing. If ramdisk is not installed, you can specify it to any directory of other disks, such as the C: \ sessions directory and C: \ Windows \ Temp directory.

Now that the basic work is complete, it is time to configure IIS.

Open "Internet Information Service (IIS) controller", and in "Web service expansion", select "Add a new Web service expansion ", for the extended name, enter "php isapi extended". select "C: \ php \ sapi \ php4isapi" for the requested file. dll (if PHP5 is installed, C: \ php \ sapi \ php5isapi is used here. dll, the same below), and set the extended status to agree.

Open "website"-> "properties"-> "ISAPI filter"-> "add", enter "PHP" as the filter name, and select "C" as the executable file: \ php \ sapi \ php4isapi. dll.

Choose "website"> "properties"> "main directory"> "exploitation program settings"> "configuration"> "exploitation program expansion"> "add ", whether to select C: \ php \ sapi \ php4isapi for the executable file. dll. Fill in ". php" in the expanded name, and set the action to "HEAD, GET, POST ".

Choose "website"> "properties"> "document"> "enable default content document"> "add" to add index. php as the default content document.

Select "server machine name"> "all tasks"> "restart IIS" to restart IIS.

Test

Create a test page under the default website announcement Directory:

Download: phptest. php


 

If the php installation configuration information is displayed on this page, the installation is successful.

If you want to optimize the performance of the php program, you can install the ZendOptimizer-2.6.0-Windows-i386.exe, this installation is very simple, here will not first accommodate.

Upgrade

Now the upgrade is very simple. You only need to download the new PHP binary package, delete the original C: \ php directory, and decompress the new version to the C: \ php directory, then restart IIS. You do not need to modify any configurations or copy any files to the System32 directory. Is it convenient?



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.