【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看到如下所示的网站,证明配置完毕!
版权声明:本文为博主原创文章,未经博主允许不得转载。

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

Alipay PHP...

Session hijacking can be achieved through the following steps: 1. Obtain the session ID, 2. Use the session ID, 3. Keep the session active. The methods to prevent session hijacking in PHP include: 1. Use the session_regenerate_id() function to regenerate the session ID, 2. Store session data through the database, 3. Ensure that all session data is transmitted through HTTPS.

JWT is an open standard based on JSON, used to securely transmit information between parties, mainly for identity authentication and information exchange. 1. JWT consists of three parts: Header, Payload and Signature. 2. The working principle of JWT includes three steps: generating JWT, verifying JWT and parsing Payload. 3. When using JWT for authentication in PHP, JWT can be generated and verified, and user role and permission information can be included in advanced usage. 4. Common errors include signature verification failure, token expiration, and payload oversized. Debugging skills include using debugging tools and logging. 5. Performance optimization and best practices include using appropriate signature algorithms, setting validity periods reasonably,

How to debug CLI mode in PHPStorm? When developing with PHPStorm, sometimes we need to debug PHP in command line interface (CLI) mode...

The application of SOLID principle in PHP development includes: 1. Single responsibility principle (SRP): Each class is responsible for only one function. 2. Open and close principle (OCP): Changes are achieved through extension rather than modification. 3. Lisch's Substitution Principle (LSP): Subclasses can replace base classes without affecting program accuracy. 4. Interface isolation principle (ISP): Use fine-grained interfaces to avoid dependencies and unused methods. 5. Dependency inversion principle (DIP): High and low-level modules rely on abstraction and are implemented through dependency injection.

How to automatically set the permissions of unixsocket after the system restarts. Every time the system restarts, we need to execute the following command to modify the permissions of unixsocket: sudo...

Static binding (static::) implements late static binding (LSB) in PHP, allowing calling classes to be referenced in static contexts rather than defining classes. 1) The parsing process is performed at runtime, 2) Look up the call class in the inheritance relationship, 3) It may bring performance overhead.

Article discusses essential security features in frameworks to protect against vulnerabilities, including input validation, authentication, and regular updates.
