The PHP best configuration method for IIS 6

Source: Internet
Author: User
Tags filter copy iis ini sapi sessions variable

The LAMP combination is good, but if you want to set up a Web virtual host server that supports PHP, ASP, ASP.net, JSP, Perl, or IIS 6 with Windows 2003, it's best. There are a lot of articles on the web that describe PHP on IIS 6, but those methods are not bad performance or upgrade trouble. The following method allows you to upgrade very easily after the first configuration.

The upgrade referred to here refers to upgrading from one PHP4 version to another PHP4 version, or upgrading from one PHP5 version to another PHP5 version, rather than upgrading from PHP4 to PHP5.

Get ready:

A Windows 2003 server is installed and IIS 6 is installed.

Download the Windows version of the PHP binary compression package .

Installation:

Unzip the PHP binary compression package into the C:\php directory (assuming C: disk is the system disk, that is, the disk of Windows system is installed, if the system disk is D: disk, then unzip to the D:\php directory, and so on, the same below).

Then open "My Computer"-> "->" "Advanced"-> "Environment variable"-> "System variable"-> "path", edit its value, and add the following path address above:

C:\php; C:\php\dlls; C:\php\extensions; C:\php\sapi

Copy the Php.ini-dist or php.ini-recommended to the C:\Windows directory, and rename it to php.ini, the server that officially publishes the website uses php.ini-dist, and as the server used for debugging uses php.ini-recommended better. Of course, under normal circumstances, this php.ini still need to be modified according to the actual situation.

Here are some of the necessary modification options:

Extension_dir = "C:\php\extensions"

This is the directory where the PHP extensions are placed, make sure you are the same as the directory you are actually installing.

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

The above, with no semicolon at the beginning, is an open extension, and a semicolon is an extension that is not open. The above settings include all extensions that can be turned on by default installation on Windows 2003 (PHP 4 is listed here).

Session.save_path = B:\sessions

This is the default save directory for the session file, which must be a directory that exists, or the default sessions function will not work. I'm setting up a directory on a RAMDisk. Setting the Session.save_path on RAMDisk can speed up session processing. If you do not have RAMDisk installed, you can assign it to any of the other disks, such as C:\sessions directory, C:\Windows\Temp directory, and so on.

OK, the basic work is done, now it's time to configure IIS:

Open Internet Information Services (IIS) Manager, and in Web service extensions, select Add a new Web service extension, and the extension can fill in the PHP ISAPI extension, the requested file selection: C:\php\sapi\ Php4isapi.dll (if the PHP5 is installed, this is C:\php\sapi\php5isapi.dll, below), and the extension status is set to allow.

Open the Web site-> Properties-> ISAPI Filter-> Add, the filter name can be filled in "PHP", and the executable file still chooses C:\php\sapi\php4isapi.dll.

Open the Web site-> Properties-> The home directory-> application settings-> configuration-> Application Extensions-> Add, or choose C:\php\sapi\php4isapi.dll for the executable file. The extension is filled with ". PHP" and the action is limited to "head,get,post".

You can add index.php as the default content document by opening the Web site-> Properties-> document-> enable default content document-> Add.

Then select the server machine name-> "All Tasks"-> "Restart IIS" to restart IIS.

Test

In the default Web site publishing directory, create a test page:

Download: phptest.php

<?php
Phpinfo ();
?>

If you open this page to see the PHP installation configuration information, even if the installation is successful.

If you want to optimize the execution of PHP program, you can install Zendoptimizer-2.6.0-windows-i386.exe, this thing installation is very simple, here is not introduced.

Upgrade

Now the upgrade is very simple. Just download the new version of the PHP binary compression pack, remove the original C:\php directory, unzip the new version to the C:\php directory, and then restart IIS. You do not need to modify any configuration, and you do not need to copy any files to the System32 directory. Isn't 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.