search
HomeBackend DevelopmentPHP Tutorial【php】在Windows2003下的IIS配置php5.4

本文与《【php】在Windows2003下配置Apache2.4与php5.4》(点击打开链接)为姊妹篇,只是php所用的服务器有点不同,这里一个是Apache2.4,一个是Windows2003自带的IIS服务器。

一、在Windows2003安装IIS

1、首先打开Windows2003的控制面板,查看是否有“管理工具”,没有也不要紧,点击“添加或删除程序”。有的话,可以直接进入第二步,IIS的配置。

2、在弹出的窗口,选择添加/删除Windows组件的功能,选择把“网络服务”组件与“应用程序服务器”的组件勾上,一般情况,单纯勾上这两个组件还不行,还要打开“应用程序服务器”组件的详细信息,把里面能勾的都勾上,如果勾上只是出现灰色小勾,那么应该打开这一项的“详细信息”,把里面的组件全部勾上。为了保证,我们的ASP网站不要因为一个组件缺少而不能运行。


3、全部组件勾完之后,点击确定,安装过程中,会要求找到Windows2003的安装镜像Windows Server 2003 Enterprise Edition SP2.iso,没有的话网上一搜一大堆。


4、安装的过程中,可能会要求你设置IP地址,点击Microsoft网络客户端选择“属性”,随便指定一个IP给Windows2003就可以的,这不是我们最终给用户呈现的IP,没关系的。


5、等待安装完成,IIS就安装完毕了。完毕之后,你可以打开IE6浏览器,直接输入http://localhost/iisstart.htm,看到一个“建设中”的页面就对了,表明IIS已经成功运行了。


二、为Windows2003下的IIS配置必备的插件

首先,Windows2003要先安装VC9的运行库与fcgi才能正常在IIS下运行php5.4。

VC9的运行库,可以在微软官网上下载。

网址:http://www.microsoft.com/zh-cn/download/details.aspx?id=29


如果各位嫌麻烦的话,可以直接把如下的地址拷贝到下载工具中下载:http://download.microsoft.com/download/7/5/0/7502f4e9-1f90-4895-9259-1bde67b8b9a1/vcredist_x86.exe

下载之后是一个vcredist_x86.exe,直接不停下一步安装,安装路径都没得你选。安装的时候会在同目录产生一些安装临时文件,请在安装完毕之后,自行删掉。

fcgi同样可以在微软的官网进行下载,网址:http://www.microsoft.com/en-us/download/details.aspx?id=11881

或者直接把如下网址扔到下载工具下载:http://222.200.129.44/download.microsoft.com/download/E/0/C/E0C0709A-66E5-4113-9A6C-A5F65BF6717D/fcgisetup_1.5_x86_rtw.msi

同样是不停下一步的安装,安装路径都没得你选。安装完毕之后,用记事本打开C:\WINDOWS\system32\inetsrv\fcgietx.ini

在末尾加上如下的文字:

[Types]php=PHP[PHP]ExePath=php压缩目录\php-cgi.exe

如图,其中php的压缩目录为C:\php-5.4.43-nts-Win32-VC9-x86,保存退出。



三、php的配置

弄好以上两个组件之后,正式可以下载php5.4了,由于php5.5以后的版本不支持winxp内核的系统,所以只能用php5.4,和Apache不同的是,打开php的官网:http://cn2.php.net/downloads.php之后,这次要下载一个非线程安全的php5.4如下图:


下载之后解压得到一个C:\php-5.4.43-nts-Win32-VC9-x86,同样是如下图,把php.ini-production改名为php.ini,直接用记事本打开。


对php.ini进行如下的修改:

(1)利用记事本的Ctrl+F,定位关键字“extension_dir”,指定php的压缩目录也就是运行目录。注意把前面表示注释的;去掉。


(2)定位Date在date.timezone指定时区为我们的国家的时区,或者写"Asia/Shanghai"也就是可以的,同样注意把前面表示注释的;去掉。


(3)最后定位extension=,开启php的服务组件,把下图划红线被注释的组件前的;去掉,以为开启字符、php邮件服务,与php_mysql服务支持。保存php.ini退出。

之后在直接新建一个php网站目录的文件夹,这里是c:\phpSite,还是在里面新建一个1.php,写一段相当经典的代码:

<?phpinfo ();?>


四、把php挂载到iis

1、通过开始->设置->控制面板->管理工具->Internet 信息服务(IIS)管理器打开IIS,右键网站->新建->网站


2、网站描述任意,这里以phpSite为例,设定发布网站的IP与端口,这里可以直接使用80端口,因为Windows2003的80端口本身就是给IIS所占据。下面以IP为192.168.80.128这个内网地址为例。


3、网站文件夹设定为刚刚建立的c:\phpSite,权限可以默认为“读取”,如果要上传文件把“写入”勾上,当然也可以之后再设置,再点下一步,完成网站的创建

4、之后,在网站下面多出了刚刚建立的phpSite,对其右键,属性,进行进一步的设置。


5、翻到“主目录”选择“配置”->"添加"->"浏览",选择C:\WINDOWS\system32\inetsrv\fcgiext.dll,扩展名填写为.php。在动作一栏,为了安全可以限制为:GET,HEAD,POST,DEBUG。如下图:


6、之后一路确定,完成配置,直接打开浏览器输入:192.168.80.128/1.php看到如下所示的网站,证明配置完毕!


版权声明:本文为博主原创文章,未经博主允许不得转载。

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
How does PHP type hinting work, including scalar types, return types, union types, and nullable types?How does PHP type hinting work, including scalar types, return types, union types, and nullable types?Apr 17, 2025 am 12:25 AM

PHP type prompts to improve code quality and readability. 1) Scalar type tips: Since PHP7.0, basic data types are allowed to be specified in function parameters, such as int, float, etc. 2) Return type prompt: Ensure the consistency of the function return value type. 3) Union type prompt: Since PHP8.0, multiple types are allowed to be specified in function parameters or return values. 4) Nullable type prompt: Allows to include null values ​​and handle functions that may return null values.

How does PHP handle object cloning (clone keyword) and the __clone magic method?How does PHP handle object cloning (clone keyword) and the __clone magic method?Apr 17, 2025 am 12:24 AM

In PHP, use the clone keyword to create a copy of the object and customize the cloning behavior through the \_\_clone magic method. 1. Use the clone keyword to make a shallow copy, cloning the object's properties but not the object's properties. 2. The \_\_clone method can deeply copy nested objects to avoid shallow copying problems. 3. Pay attention to avoid circular references and performance problems in cloning, and optimize cloning operations to improve efficiency.

PHP vs. Python: Use Cases and ApplicationsPHP vs. Python: Use Cases and ApplicationsApr 17, 2025 am 12:23 AM

PHP is suitable for web development and content management systems, and Python is suitable for data science, machine learning and automation scripts. 1.PHP performs well in building fast and scalable websites and applications and is commonly used in CMS such as WordPress. 2. Python has performed outstandingly in the fields of data science and machine learning, with rich libraries such as NumPy and TensorFlow.

Describe different HTTP caching headers (e.g., Cache-Control, ETag, Last-Modified).Describe different HTTP caching headers (e.g., Cache-Control, ETag, Last-Modified).Apr 17, 2025 am 12:22 AM

Key players in HTTP cache headers include Cache-Control, ETag, and Last-Modified. 1.Cache-Control is used to control caching policies. Example: Cache-Control:max-age=3600,public. 2. ETag verifies resource changes through unique identifiers, example: ETag: "686897696a7c876b7e". 3.Last-Modified indicates the resource's last modification time, example: Last-Modified:Wed,21Oct201507:28:00GMT.

Explain secure password hashing in PHP (e.g., password_hash, password_verify). Why not use MD5 or SHA1?Explain secure password hashing in PHP (e.g., password_hash, password_verify). Why not use MD5 or SHA1?Apr 17, 2025 am 12:06 AM

In PHP, password_hash and password_verify functions should be used to implement secure password hashing, and MD5 or SHA1 should not be used. 1) password_hash generates a hash containing salt values ​​to enhance security. 2) Password_verify verify password and ensure security by comparing hash values. 3) MD5 and SHA1 are vulnerable and lack salt values, and are not suitable for modern password security.

PHP: An Introduction to the Server-Side Scripting LanguagePHP: An Introduction to the Server-Side Scripting LanguageApr 16, 2025 am 12:18 AM

PHP is a server-side scripting language used for dynamic web development and server-side applications. 1.PHP is an interpreted language that does not require compilation and is suitable for rapid development. 2. PHP code is embedded in HTML, making it easy to develop web pages. 3. PHP processes server-side logic, generates HTML output, and supports user interaction and data processing. 4. PHP can interact with the database, process form submission, and execute server-side tasks.

PHP and the Web: Exploring its Long-Term ImpactPHP and the Web: Exploring its Long-Term ImpactApr 16, 2025 am 12:17 AM

PHP has shaped the network over the past few decades and will continue to play an important role in web development. 1) PHP originated in 1994 and has become the first choice for developers due to its ease of use and seamless integration with MySQL. 2) Its core functions include generating dynamic content and integrating with the database, allowing the website to be updated in real time and displayed in personalized manner. 3) The wide application and ecosystem of PHP have driven its long-term impact, but it also faces version updates and security challenges. 4) Performance improvements in recent years, such as the release of PHP7, enable it to compete with modern languages. 5) In the future, PHP needs to deal with new challenges such as containerization and microservices, but its flexibility and active community make it adaptable.

Why Use PHP? Advantages and Benefits ExplainedWhy Use PHP? Advantages and Benefits ExplainedApr 16, 2025 am 12:16 AM

The core benefits of PHP include ease of learning, strong web development support, rich libraries and frameworks, high performance and scalability, cross-platform compatibility, and cost-effectiveness. 1) Easy to learn and use, suitable for beginners; 2) Good integration with web servers and supports multiple databases; 3) Have powerful frameworks such as Laravel; 4) High performance can be achieved through optimization; 5) Support multiple operating systems; 6) Open source to reduce development costs.

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)
1 months agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
1 months agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Chat Commands and How to Use Them
1 months agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

SublimeText3 Linux new version

SublimeText3 Linux new version

SublimeText3 Linux latest version

Atom editor mac version download

Atom editor mac version download

The most popular open source editor

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

VSCode Windows 64-bit Download

VSCode Windows 64-bit Download

A free and powerful IDE editor launched by Microsoft