Windows Server 2008 R2 IIS7.5+PHP5(FastCGI)+MySQL5环境搭建教程

时间:2022-10-27 23:02:15

Windows Server 2008 R2 IIS7.5+PHP5(FastCGI)+MySQL5环境搭建教程

准备篇

一、环境说明:

操作系统:Windows Server 2008 R2

PHP版本:php 5.4.4

MySQL版本:MySQL5.5.25

二、相关软件下载:

1、PHP下载地址:

http://windows.php.net/downloads/releases/php-5.4.4-nts-Win32-VC9-x86.zip

2、MySQL下载地址:

http://gd.tuwien.ac.at/db/mysql/Downloads/MySQLInstaller/mysql-installer-5.5.25.0.msi

3、PHP加速软件ZendGuard下载地址:

http://downloads.zend.com/guard/5.5.0/ZendGuardLoader-php-5.3-Windows.zip

4、Microsoft .NET Framework 4(独立安装程序)下载地址:

http://download.microsoft.com/download/9/5/A/95A9616B-7A37-4AF6-BC36-D6EA96C8DAAE/dotNetFx40_Full_x86_x64.exe

5、Microsoft Visual C++ 2010 可再发行组件包 (x64)下载地址:

http://download.microsoft.com/download/3/2/2/3224B87F-CFA0-4E70-BDA3-3DE650EFEBA5/vcredist_x64.exe

6、Microsoft Visual C++ 2008 Redistributable Package (x86)下载地址:

http://download.microsoft.com/download/7/5/0/7502f4e9-1f90-4895-9259-1bde67b8b9a1/vcredist_x86.exe

安装篇

一、安装IIS7.5

开始-管理工具-服务器管理器

Windows Server 2008 R2 IIS7.5+PHP5(FastCGI)+MySQL5环境搭建教程

Windows Server 2008 R2 IIS7.5+PHP5(FastCGI)+MySQL5环境搭建教程

系统运维 www.osyunwei.com 温馨提醒:qihang01原创内容©版权所有,转载请注明出处及原文链接

选择“角色”点右边的添加角色

Windows Server 2008 R2 IIS7.5+PHP5(FastCGI)+MySQL5环境搭建教程

下一步

Windows Server 2008 R2 IIS7.5+PHP5(FastCGI)+MySQL5环境搭建教程

选择“Web服务器(IIS)”,下一步

Windows Server 2008 R2 IIS7.5+PHP5(FastCGI)+MySQL5环境搭建教程

下一步

Windows Server 2008 R2 IIS7.5+PHP5(FastCGI)+MySQL5环境搭建教程

确保“CGI”被选中,其他的角色服务可根据自己的需要勾选

这里全部勾选

下一步

Windows Server 2008 R2 IIS7.5+PHP5(FastCGI)+MySQL5环境搭建教程

安装

Windows Server 2008 R2 IIS7.5+PHP5(FastCGI)+MySQL5环境搭建教程

正在安装

Windows Server 2008 R2 IIS7.5+PHP5(FastCGI)+MySQL5环境搭建教程

关闭,在浏览器里面打开http://localhost/

出现下面的界面

Windows Server 2008 R2 IIS7.5+PHP5(FastCGI)+MySQL5环境搭建教程

IIS7.5安装完成

二、安装Microsoft Visual C++ 2010 可再发行组件包 (x64)

双击打开vcredist_x64.exe

Windows Server 2008 R2 IIS7.5+PHP5(FastCGI)+MySQL5环境搭建教程

Windows Server 2008 R2 IIS7.5+PHP5(FastCGI)+MySQL5环境搭建教程

选中“我已阅读并接受许可条款”,点安装

Windows Server 2008 R2 IIS7.5+PHP5(FastCGI)+MySQL5环境搭建教程

正在安装

Windows Server 2008 R2 IIS7.5+PHP5(FastCGI)+MySQL5环境搭建教程

完成

三、安装Microsoft .NET Framework 4(独立安装程序)

双击dotNetFx40_Full_x86_x64.exe

Windows Server 2008 R2 IIS7.5+PHP5(FastCGI)+MySQL5环境搭建教程

选中“我已阅读并接受许可条款”,点安装

Windows Server 2008 R2 IIS7.5+PHP5(FastCGI)+MySQL5环境搭建教程

Windows Server 2008 R2 IIS7.5+PHP5(FastCGI)+MySQL5环境搭建教程

正在安装

Windows Server 2008 R2 IIS7.5+PHP5(FastCGI)+MySQL5环境搭建教程

点完成,安装完毕。

四、安装MySQL

双击打开mysql-installer-5.5.25.0

Windows Server 2008 R2 IIS7.5+PHP5(FastCGI)+MySQL5环境搭建教程

Windows Server 2008 R2 IIS7.5+PHP5(FastCGI)+MySQL5环境搭建教程

选择第一项Install MySQL Products(安装MySQL)

Windows Server 2008 R2 IIS7.5+PHP5(FastCGI)+MySQL5环境搭建教程

选中“I accept the license terms”(我接受许可条款),点Next

Windows Server 2008 R2 IIS7.5+PHP5(FastCGI)+MySQL5环境搭建教程

选中“Skip the check for update (not recommended)”(跳过检查更新),点Next

Windows Server 2008 R2 IIS7.5+PHP5(FastCGI)+MySQL5环境搭建教程

选中“Custom”(自定义安装),Installation Path(安装路径):D:\Program Files\MySQL

Next

Windows Server 2008 R2 IIS7.5+PHP5(FastCGI)+MySQL5环境搭建教程

确保“MySQL Server5.5.25”被选中,点Next(其他的组件可以选择安装)

这里全部选中,安装所有组件

Windows Server 2008 R2 IIS7.5+PHP5(FastCGI)+MySQL5环境搭建教程

Execute (执行)

Windows Server 2008 R2 IIS7.5+PHP5(FastCGI)+MySQL5环境搭建教程

选中“我已阅读并接受许可条款”

点安装

Windows Server 2008 R2 IIS7.5+PHP5(FastCGI)+MySQL5环境搭建教程

完成

Windows Server 2008 R2 IIS7.5+PHP5(FastCGI)+MySQL5环境搭建教程

Next

Windows Server 2008 R2 IIS7.5+PHP5(FastCGI)+MySQL5环境搭建教程

Execute (执行)

Windows Server 2008 R2 IIS7.5+PHP5(FastCGI)+MySQL5环境搭建教程

Next

Windows Server 2008 R2 IIS7.5+PHP5(FastCGI)+MySQL5环境搭建教程

系统运维 www.osyunwei.com 温馨提醒:qihang01原创内容©版权所有,转载请注明出处及原文链接

Next

Windows Server 2008 R2 IIS7.5+PHP5(FastCGI)+MySQL5环境搭建教程

Developer Machine(开发服务器)

Server Machine(普通服务器)

Dedicated Machine(专用服务器)

这里选择第二项: Server Machine(普通服务器)

点Next

Windows Server 2008 R2 IIS7.5+PHP5(FastCGI)+MySQL5环境搭建教程

勾选“Enable TCP/IP Networking”(开启TCP网络端口)

Port Number(端口):3306

勾选“Create Windows Service”(创建Windows系统服务)

Windows Server Name(Windows服务名):MySQL55

MySQL Root password:输入密码

Repeat Password:重复输入密码

设置好之后,点Next

Windows Server 2008 R2 IIS7.5+PHP5(FastCGI)+MySQL5环境搭建教程

Next

Windows Server 2008 R2 IIS7.5+PHP5(FastCGI)+MySQL5环境搭建教程

Next

Windows Server 2008 R2 IIS7.5+PHP5(FastCGI)+MySQL5环境搭建教程

点Finish(完成)

Windows Server 2008 R2 IIS7.5+PHP5(FastCGI)+MySQL5环境搭建教程

关闭此窗口

Windows Server 2008 R2 IIS7.5+PHP5(FastCGI)+MySQL5环境搭建教程

打开MySQL安装路径

D:\Program Files\MySQL\MySQL Server 5.5

复制my-huge.ini为my.ini

备份my-huge.ini为my-huge.ini_bak

Windows Server 2008 R2 IIS7.5+PHP5(FastCGI)+MySQL5环境搭建教程

开始-所有程序-MySQL-MySQL Server 5.5- MySQL Server 5.5 Command Line Client

Windows Server 2008 R2 IIS7.5+PHP5(FastCGI)+MySQL5环境搭建教程

输入安装时候的MySQL root账号密码,回车

Windows Server 2008 R2 IIS7.5+PHP5(FastCGI)+MySQL5环境搭建教程

登录成功,MySQL安装完成。

五、安装Microsoft Visual C++ 2008 Redistributable Package (x86)

双击打开vcredist_x86.exe

Windows Server 2008 R2 IIS7.5+PHP5(FastCGI)+MySQL5环境搭建教程

下一步

Windows Server 2008 R2 IIS7.5+PHP5(FastCGI)+MySQL5环境搭建教程

勾选“我已阅读并接受许可条款”

点安装

Windows Server 2008 R2 IIS7.5+PHP5(FastCGI)+MySQL5环境搭建教程

完成

六、安装PHP

解压php-5.4.4-nts-Win32-VC9-x86.zip文件

Windows Server 2008 R2 IIS7.5+PHP5(FastCGI)+MySQL5环境搭建教程

Windows Server 2008 R2 IIS7.5+PHP5(FastCGI)+MySQL5环境搭建教程

重命名文件夹为php,把php文件夹拷贝到D盘根目录

Windows Server 2008 R2 IIS7.5+PHP5(FastCGI)+MySQL5环境搭建教程

解压ZendGuardLoader-php-5.3-Windows.zip

Windows Server 2008 R2 IIS7.5+PHP5(FastCGI)+MySQL5环境搭建教程

打开

D:\soft\ZendGuardLoader-php-5.3-Windows\ZendGuardLoader-php-5.3-Windows\php-5.3.x

把里面的ZendLoader.dll文件拷贝到D:\php\ext目录中

Windows Server 2008 R2 IIS7.5+PHP5(FastCGI)+MySQL5环境搭建教程

打开D:\php

复制php.ini-development为php.ini

用记事本打开php.ini

做如下修改:

extension_dir = "D:\php\ext" #设置php模块路径

date.timezone = PRC #设置时区为中国时区

register_globals = On #开启GET数据调用

short_open_tag = On #php支持短标签

cgi.force_redirect = 0 #开启以CGI方式运行php

fastcgi.impersonate = 1;

cgi.rfc2616_headers = 1

以下php扩展模块,根据需要选择开启,取消前面的分号为开始相应扩展模块

extension=php_curl.dll

extension=php_gd2.dll

extension=php_mbstring.dll

extension=php_exif.dll

extension=php_mysql.dll

extension=php_mysqli.dll

extension=php_sockets.dll

extension=php_xmlrpc.dll

extension=php_pdo_mysql.dll

Windows Server 2008 R2 IIS7.5+PHP5(FastCGI)+MySQL5环境搭建教程

在最后一行添加以下代码

[ZendGuardLoader]

zend_loader.enable=1

zend_loader.disable_licensing=1

zend_loader.obfuscation_level_support=3

zend_loader.license_path=

zend_extension="D:\php\ext\ZendLoader.dll"

Windows Server 2008 R2 IIS7.5+PHP5(FastCGI)+MySQL5环境搭建教程

系统运维 www.osyunwei.com 温馨提醒:qihang01原创内容©版权所有,转载请注明出处及原文链接

最后,保存退出

七、配置IIS支持PHP

开始-管理工具- Internet 信息服务(IIS)管理器

Windows Server 2008 R2 IIS7.5+PHP5(FastCGI)+MySQL5环境搭建教程

双击左边“起始页”下面的计算机名称

找到中间的IIS部分,打开“处理程序映射”

Windows Server 2008 R2 IIS7.5+PHP5(FastCGI)+MySQL5环境搭建教程

点右边的“添加模块映射”

Windows Server 2008 R2 IIS7.5+PHP5(FastCGI)+MySQL5环境搭建教程

请求路径:*.php

模块:FastCgiModule

可执行文件(可选):D:\php\php-cgi.exe

名称:FastCGI

最后,确定

Windows Server 2008 R2 IIS7.5+PHP5(FastCGI)+MySQL5环境搭建教程

点“是”

Windows Server 2008 R2 IIS7.5+PHP5(FastCGI)+MySQL5环境搭建教程

双击左边“起始页”下面的计算机名称

找到中间的IIS部分,打开“FastCGI设置”

Windows Server 2008 R2 IIS7.5+PHP5(FastCGI)+MySQL5环境搭建教程

右键选中:D:\php\php-cgi.exe然后选择编辑

Windows Server 2008 R2 IIS7.5+PHP5(FastCGI)+MySQL5环境搭建教程

监视对文件所做的更改:D:\php\php.ini

Windows Server 2008 R2 IIS7.5+PHP5(FastCGI)+MySQL5环境搭建教程

环境变量,点旁边的"..."

Windows Server 2008 R2 IIS7.5+PHP5(FastCGI)+MySQL5环境搭建教程

点“添加”

Windows Server 2008 R2 IIS7.5+PHP5(FastCGI)+MySQL5环境搭建教程

Name:PHP_FCGI_MAX_REQUESTS

Value:10000

确定

Windows Server 2008 R2 IIS7.5+PHP5(FastCGI)+MySQL5环境搭建教程

确定

测试篇

打开:

C:\inetpub\wwwroot

新建一个index.php文件

内容如下:

<?php

phpinfo();

?>

最后,保存退出

Windows Server 2008 R2 IIS7.5+PHP5(FastCGI)+MySQL5环境搭建教程

在浏览器里面打开http://localhost/

出现下面的界面,说明配置成功!

Windows Server 2008 R2 IIS7.5+PHP5(FastCGI)+MySQL5环境搭建教程

至此,Windows Server 2008 R2 IIS7.5+PHP5(FastCGI)+MySQL5环境搭建教程完成。

      Windows Server 2008 R2 IIS7.5+PHP5(FastCGI)+MySQL5环境搭建教程
» 订阅本站: http://www.osyunwei.com/feed