search
HomeOperation and MaintenanceWindows Operation and MaintenanceDetailed introduction on how to install and configure IIS+PHP 5.2 under Windows

PHPInstallation under Windows is simple, but if you don’t pay attention to the method, it will still give you a headache. In addition, the PHP 5.2 version is also somewhat different from the previous 4.x version, so it is necessary to record it to avoid forgetting such an installation and configuration method next time.

Step 1: Download the php 5.2 for windows installation package and extract it to C:\php. Note that this decompression directory can be on any disk, but the directory name cannot contain spaces;
The following is the file directory of php5.2:

c:\php 
--dev 
| |-php5ts.lib 
--ext -- extension 
DL
Ls for PHP 
| |-php_bz2.dll 
| |-php_cpdf.dll 
| |-.. 
--extras 
| --mibs -- support 
file
s for SNMP 
| --openssl -- support files for Openssl 
| --pdf-related -- support files for PDF 
| |-mime.magic 
--pear -- initial 
copy
 of PEAR 
| 
|-go-pear.bat -- PEAR 
set
up script 
|-fdftk.dll 
|-.. 
|-php-cgi.exe -- CGI executable 
|-php-win.exe -- executes scripts without an opened command prompt 
|-php.exe -- CLI executable - ONLY for command line scripting 
|-.. 
|-php.ini-dist -- default php.ini settings 
|-php.ini-recomm
end
ed -- recommended php.ini settings 
|-php5activescript.dll 
|-php5apache.dll 
|-php5apache2.dll 
|-.. 
|-php5ts.dll -- core PHP DLL 
|-...

Step 2: Change the c:\php directory Copy the php.ini-recommended (or php.ini-dist file, the former is officially recommended) to the current directory, and change the file name to php.ini;

Step 3: Edit php.ini. Mainly modify the values ​​of the following two lines:

extension_
dir
 = "c:\php\ext" 
doc_root = "c:\inetpub\wwwroot"

When modifying, you need todeletethe;comment at the beginning of these two lines. The value of extension_dir is the ext directory under the PHP installation directory, and the value of doc_root is the home directory set by IIS;

Step 4: Set environment variables. Add the following value after Path:
;:\php
Then restart the computer.

Step 5: Open the Internet Information Service, find the "Default Website" and stop the website. Then open the "Properties" page. Find the "Home Directory" label in the "Properties" page, click the "Configuration" button, and add application mapping. The values ​​are:
Executable file: c:\php\php5isapi.dll
Extension: .php
No need to modify the rest. After confirmation, restart the default website;

Step 6: Create a new file hello.php under c:\inetpub\wwwroot. Input content:

<html> 
<
head
> 
<title>World</title> 
</head> 
<body> 
<?php 
echo
 "Hello world" ?> 
</body> 
</html>

保存后,打开浏览器,输入地址:localhost/hello.php。如果网页中显示Hello world则说明安装正确。我们也可以在网页中通过查看hello.php的源代码,如果源代码中没有php代码,也说明安装是正确的。

参考了大量别人的安装文档后自己总结的一点东西,希望对大家有用。。。。
1. php安装的二种不同模式――CGI模式和模块化安装模式
在CGI模式下,如果客户机请求一个php文件,web服务器就调用php.exe去解释这个文件,然后再把解释的结果以网页的形式返回给客户机;而在模块化中,php与web服务器一起启动并运行的,所以从某种角度上来说,以apache模块方式安装php比CGI模式更好的安全性及更好的执行效率和速度
以下例子均以php4.4.0为例,在windows xp环境下实现。
1. IIS下的安装(ISAPI模式安装)
(1) 将php压缩包解压到c:\php\下
(2) 将php.ini-dist改名为php.ini后拷贝到c:\windows下(window 2000拷贝到c:\ winnt)
(3) 把c:\php\php4ts.dll拷贝到c:\windows\system32下(不一定需要)
(4) IIS5.0的配置。打开“控制面板”=》“管理工具”=》“Internet 服务管理器”。
右键点击“默认Web站点”,选“属性”。
单击“ISAPI筛选器”标签,点击“添加”,选择c:\php\sapi的php4isapi.dll,名字取为PHP。
单击主目录下的配置按钮,在“应用程序配置”对话框中单击“添加”将出现“添加/编辑应用程序扩展名映射”对话框。点击“浏览”,选择c:\php\sapi的php4isapi.dll。扩展名.php,其它默认即可。
2. IIS下的安装(CGI模式安装)
(1) 下载php的windows安装程序php-4.4.0-installer.exe,该安装程序不包括任何外部的php扩展(php_*.dll)。
(2) 按照向导一步步安装,安装向导会收集足够的信息来设置php.ini文件,并自动配置好IIS服务器。(以apache作服务器时也可以,但不能自动配置,需手动进行)
(3) 安装完成即为IIS安装CGI模式的php。
3. Apache的安装(模块化安装模式)
以apache 2.0.55为例说明
(1) 下载apache的安装包apache_2.0.55-win32-x86-no_ssl.exe。
(2) 运行你下载的安装文件安装apache安装文件会提示你输入主机名,管理员信箱等信息,这些信息安装完后可以在httpd.conf中修改,可以放心输入。
(3) 为了方便以后的操作,建议修改默认的安装程序性路径,这里我修改为“c:”
(4) 安装完成后,需要编辑apache2/conf/httpd.conf文件。
(5) 由于IIS默认占用80端口,我们需修改ServerName为“localhost:81”(213行)及端口号为81(120行的listen 80修改为listen 81)
(6) 加载php支持的apache的模块php4apache2.dll,在134行加入“LoadModule php4_module c:/php/sapi/php4apache2.dll”
(7) 加载支持的后缀名,在757行加入“AddType application/x-httpd-php .php .php3 .php4”
(8) 添加默认识别的php文件名,找到DirectoryIndex所在的322行,添加“index.php default.php default.htm default.html”
(9) 把c:\php\php4ts.dll拷贝到c:\windows\system32下(一定)
(10)打开开始菜单->运行,输入cmd命令
(11)进入到apache2/bin目录,运行apache –k install和apache –k start命令
(12)访问http://localhost:81显示APACHE欢迎页(apache安装成功)
(13)把要调试的php程序放到apache2/htdocs下,即可以调试php程序。
(14)也可将修改php调试程序放到自定义路径,修改httpd.conf的DocumentRoot的值即可
配置服务器的GD库支持:

1. 打开php.ini文件,找到extension=php_gd2.dll,并去掉前面的分号(555行)
2. 找到extension_dir并修改“extension_dir = "./"”为你安装php所在的extensions目录,我的是extension_dir = "c:/PHP/extensions"
3. 重启apache服务器即可

The above is the detailed content of Detailed introduction on how to install and configure IIS+PHP 5.2 under Windows. For more information, please follow other related articles on the PHP Chinese website!

Statement
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
c盘的users是什么文件夹?可以删除吗?c盘的users是什么文件夹?可以删除吗?Nov 10, 2022 pm 06:20 PM

c盘的users是用户文件夹,主要存放用户的各项配置文件。users文件夹是windows系统的重要文件夹,不能随意删除;它保存了很多用户信息,一旦删除会造成数据丢失,严重的话会导致系统无法启动。

启动任务管理器的三个快捷键是什么启动任务管理器的三个快捷键是什么Sep 21, 2022 pm 02:47 PM

启动任务管理器的三个快捷键是:1、“Ctrl+Shift+Esc”,可直接打开任务管理器;2、“Ctrl+Alt+Delete”,会进入“安全选项”的锁定界面,选择“任务管理器”,即可以打开任务管理器;3、“Win+R”,会打开“运行”窗口,输入“taskmgr”命令,点击“确定”即可调出任务管理器。

window下报错“php不是内部或外部命令”怎么解决window下报错“php不是内部或外部命令”怎么解决Mar 23, 2023 pm 02:11 PM

对于刚刚开始使用PHP的用户来说,如果在Windows操作系统中遇到了“php不是内部或外部命令”的问题,可能会感到困惑。这个错误通常是由于系统无法识别PHP的路径导致的。在本文中,我将为您提供一些可能会导致这个问题的原因和解决方法,以帮助您快速解决这个问题。

微软的pin码是什么微软的pin码是什么Oct 14, 2022 pm 03:16 PM

PIN码是Windows系统为了方便用户本地登录而独立于window账户密码的快捷登录密码,是Windows系统新添加的一套本地密码策略;在用户登陆了Microsoft账户后就可以设置PIN来代替账户密码,不仅提高安全性,而且也可以让很多和账户相关的操作变得更加方便。PIN码只能通过本机登录,无法远程使用,所以不用担心PIN码被盗。

win10自带的onenote是啥版本win10自带的onenote是啥版本Sep 09, 2022 am 10:56 AM

win10自带的onenote是UWP版本;onenote是一套用于自由形式的信息获取以及多用户协作工具,而UWP版本是“Universal Windows Platform”的简称,表示windows通用应用平台,不是为特定的终端设计的,而是针对使用windows系统的各种平台。

win10为什么没有“扫雷”游戏了win10为什么没有“扫雷”游戏了Aug 17, 2022 pm 03:37 PM

因为win10系统是不自带扫雷游戏的,需要用户自行手动安装。安装步骤:1、点击打开“开始菜单”;2、在打开的菜单中,找到“Microsoft Store”应用商店,并点击进入;3、在应用商店主页的搜索框中,搜索“minesweeper”;4、在搜索结果中,点击选择需要下载的“扫雷”游戏;5、点击“获取”按钮,等待获取完毕后自动完成安装游戏即可。

在windows中鼠标指针呈四箭头时一般表示什么在windows中鼠标指针呈四箭头时一般表示什么Dec 17, 2020 am 11:39 AM

在windows中鼠标指针呈四箭头时一般表示选中对象可以上、下、左、右移动。在Windows中鼠标指针首次用不同的指针来表示不同的状态,如系统忙、移动中、拖放中;在Windows中使用的鼠标指针文件还被称为“光标文件”或“动态光标文件”。

windows操作系统的特点包括什么windows操作系统的特点包括什么Sep 28, 2020 pm 12:02 PM

windows操作系统的特点包括:1、图形界面;直观高效的面向对象的图形用户界面,易学易用。2、多任务;允许用户同时运行多个应用程序,或在一个程序中同时做几件事情。3、即插即用。4、出色的多媒体功能。5、对内存的自动化管理。

See all articles

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 agoBy尊渡假赌尊渡假赌尊渡假赌
Repo: How To Revive Teammates
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Safe Exam Browser

Safe Exam Browser

Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

Dreamweaver Mac version

Dreamweaver Mac version

Visual web development tools