Home php教程 php手册 iis配置php环境

iis配置php环境

Jun 06, 2016 pm 07:49 PM
iis php optimal environment Configuration

IIS6的PHP最佳配置方法 本文收藏自网络,本人还没有试过,不知如何,现在PHP版本已经到了5.2了。读者应该找找新的文章,本人自已搭建了一个Apache+PHP+Mysql+Mysqladmin平台,只用做学习用,还没真正实战过。!!! ###adv### 虽然 LAMP 组合很不错,但是如果想

IIS6的PHP最佳配置方法

  本文收藏自网络,本人还没有试过,不知如何,现在PHP版本已经到了5.2了。读者应该找找新的文章,本人自已搭建了一个Apache+PHP+Mysql+Mysqladmin平台,只用做学习用,还没真正实战过。!!!

###adv###

  虽然 LAMP 组合很不错,但是如果想要架设一台同时支持 PHP、ASP、ASP.NET、JSP、Perl 的 Web 虚拟主机服务器,还是用 Windows 2003 的 IIS 6 最好。网上有很多介绍在 IIS 6 上配置 PHP 的文章,但是那些方法不是性能不好,就是升级麻烦。下面的方法可以让你在第一次配置好后,能够非常方便的进行升级。

  这里所说的升级,是指从某个 php4 版本升级到另一个 php4 版本,或者从某个 php5 版本升级到另一个 php5 版本,而不是指从 php4 升级到 php5。

  准备:

  1、一台安装好的 Windows 2003 服务器,并且已经安装了 IIS 6。

  2、下载 windows 版的 PHP 二进制压缩包

  安装:

  解压缩 PHP 二进制压缩包到 C:\php 目录下(这里假设 C: 盘是系统盘,即安装了Windows 系统的盘,如果系统盘是 D: 盘,则解压缩到 D:\php 目录下,以此类推,下同)。

  然后打开“我的电脑”->“属性”->“高级”->“环境变量”->“系统变量”->“path”,编辑其值,在前面增加下面的路径地址:

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

  将 php.ini-dist 或 php.ini-recommended 复制到 C:\Windows 目录下,并改名为 php.ini,一般正式发布网站的服务器用 php.ini-dist,而作为调试用的服务器用 php.ini-recommended 更好。当然一般情况下,这个 php.ini 还是需要根据实际情况来修改的。

  下面来介绍一下几个必要的修改选项:

 

以下是引用片段:
  extension_dir = "C:\php\extensions" 
  这个是 PHP 扩展所放置的目录,请确保跟你实际安装的目录相同。 
  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

 

  上面这些,开头没有加分号的是打开的扩展,加了分号的是没有打开的扩展。上面的设置包含了在 Windows 2003 上默认安装情况下可以打开所有扩展(这里列出的是 php 4 的)。

  session.save_path = c:\sessions

  这个是 session 文件默认保存的目录,这个目录必须是一个存在的目录,不然默认的 session 功能会无效。我这里设置的是一个 ramdisk 上的一个目录。将 session.save_path 设置在 ramdisk 上可以加快 session 处理的速度。如果你没有安装 ramdisk,你可以把它指定到其他盘的任何一个目录下,如 C:\sessions 目录、C:\Windows\Temp 目录等。

  OK,基本工作作完了,现在该配置 IIS 了。

  打开“ Internet 信息服务(IIS)管理器”,在“ Web 服务扩展”里,选择“添加一个新的 Web 服务扩展”,扩展名可填写“PHP ISAPI 扩展”,要求的文件选择:C:\php\sapi\php4isapi.dll(如果安装的是 PHP5,则此处是 C:\php\sapi\php5isapi.dll,下同),并设置扩展状态为允许。

  打开“网站”->“属性”->“ISAPI 筛选器”->“添加”,筛选器名称可填写“PHP”,可执行文件仍然选择 C:\php\sapi\php4isapi.dll。

  打开“网站”->“属性”->“主目录”->“应用程序设置”->“配置”->“应用程序扩展”->“添加”,可执行文件还是选择 C:\php\sapi\php4isapi.dll。扩展名填写“.php”,动作限制为“HEAD,GET,POST”。

  打开“网站”->“属性”->“文档”->“启用默认内容文档”->“添加”,可以将 index.php 添加为默认内容文档。

  然后选择“服务器机器名”->“所有任务”->“重新启动 IIS”来重启 IIS。

  测试

  在默认网站发布目录下,建立一个测试页面:

  下载:phptest.php

  phpinfo();

  ?>

  如果打开这个页面能够看到 php 安装配置信息,就算是安装成功了。

  如果想要更优化的执行 php 程序,可以安装 ZendOptimizer-2.6.0-Windows-i386.exe ,这个东西安装非常简单,这里就不介绍了。

  升级

  现在升级就非常简单了。只需要将新版本的 PHP 二进制压缩包下载下来,将原来的 C:\php 目录删除,将新版本解压缩到 C:\php 目录中,然后重新启动一下 IIS 就可以了。不需要修改任何配置,也不需要往 System32 目录中复制任何文件。是不是很方便啊?

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Repo: How To Revive Teammates
1 months ago By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

PHP 8.4 Installation and Upgrade guide for Ubuntu and Debian PHP 8.4 Installation and Upgrade guide for Ubuntu and Debian Dec 24, 2024 pm 04:42 PM

PHP 8.4 brings several new features, security improvements, and performance improvements with healthy amounts of feature deprecations and removals. This guide explains how to install PHP 8.4 or upgrade to PHP 8.4 on Ubuntu, Debian, or their derivati

CakePHP Date and Time CakePHP Date and Time Sep 10, 2024 pm 05:27 PM

To work with date and time in cakephp4, we are going to make use of the available FrozenTime class.

CakePHP File upload CakePHP File upload Sep 10, 2024 pm 05:27 PM

To work on file upload we are going to use the form helper. Here, is an example for file upload.

Discuss CakePHP Discuss CakePHP Sep 10, 2024 pm 05:28 PM

CakePHP is an open-source framework for PHP. It is intended to make developing, deploying and maintaining applications much easier. CakePHP is based on a MVC-like architecture that is both powerful and easy to grasp. Models, Views, and Controllers gu

How To Set Up Visual Studio Code (VS Code) for PHP Development How To Set Up Visual Studio Code (VS Code) for PHP Development Dec 20, 2024 am 11:31 AM

Visual Studio Code, also known as VS Code, is a free source code editor — or integrated development environment (IDE) — available for all major operating systems. With a large collection of extensions for many programming languages, VS Code can be c

CakePHP Creating Validators CakePHP Creating Validators Sep 10, 2024 pm 05:26 PM

Validator can be created by adding the following two lines in the controller.

CakePHP Quick Guide CakePHP Quick Guide Sep 10, 2024 pm 05:27 PM

CakePHP is an open source MVC framework. It makes developing, deploying and maintaining applications much easier. CakePHP has a number of libraries to reduce the overload of most common tasks.

How do you parse and process HTML/XML in PHP? How do you parse and process HTML/XML in PHP? Feb 07, 2025 am 11:57 AM

This tutorial demonstrates how to efficiently process XML documents using PHP. XML (eXtensible Markup Language) is a versatile text-based markup language designed for both human readability and machine parsing. It's commonly used for data storage an

See all articles