- 时间:2022-05-05 16:28 编辑: 来源: 阅读:
- 扫一扫,手机访问
摘要:Win2008 R2 IIS7.5+PHP5(FastCGI)+MySQL5环境搭建教程
[b]准备篇[/b]
[b]一、环境说明:[/b]
操作系统:Windows Server 2008 R2
PHP版本:php 5.4.4
MySQL版本:MySQL5.5.25
[b]二、相关软件下载:[/b]
1、PHP下载地址:
[url=http://windows.php.net/downloads/releases/php-5.4.4-nts-Win32-VC9-x86.zip]http://windows.php.net/downloads/releases/php-5.4.4-nts-Win32-VC9-x86.zip[/url]
2、MySQL下载地址:
[url=http://gd.tuwien.ac.at/db/mysql/Downloads/MySQLInstaller/mysql-installer-5.5.25.0.msi]http://gd.tuwien.ac.at/db/mysql/Downloads/MySQLInstaller/mysql-installer-5.5.25.0.msi[/url]
3、PHP加速软件ZendGuard下载地址:
[url=http://downloads.zend.com/guard/5.5.0/ZendGuardLoader-php-5.3-Windows.zip]http://downloads.zend.com/guard/5.5.0/ZendGuardLoader-php-5.3-Windows.zip[/url]
4、Microsoft .NET Framework 4(独立安装程序)下载地址:
[url=http://download.microsoft.com/download/9/5/A/95A9616B-7A37-4AF6-BC36-D6EA96C8DAAE/dotNetFx40_Full_x86_x64.exe]http://download.microsoft.com/download/9/5/A/95A9616B-7A37-4AF6-BC36-D6EA96C8DAAE/dotNetFx40_Full_x86_x64.exe[/url]
5、Microsoft Visual C++ 2010 可再发行组件包 (x64)下载地址:
[url=http://download.microsoft.com/download/3/2/2/3224B87F-CFA0-4E70-BDA3-3DE650EFEBA5/vcredist_x64.exe]http://download.microsoft.com/download/3/2/2/3224B87F-CFA0-4E70-BDA3-3DE650EFEBA5/vcredist_x64.exe[/url]
6、Microsoft Visual C++ 2008 Redistributable Package (x86)下载地址:
[url=http://download.microsoft.com/download/7/5/0/7502f4e9-1f90-4895-9259-1bde67b8b9a1/vcredist_x86.exe]http://download.microsoft.com/download/7/5/0/7502f4e9-1f90-4895-9259-1bde67b8b9a1/vcredist_x86.exe[/url]
[b]安装篇[/b]
[b]一、安装IIS7.5[/b]
开始-管理工具-服务器管理器
[img]http://files.jb51.net/file_images/article/201303/1387.jpg[/img]
[img]http://files.jb51.net/file_images/article/201303/1388.jpg[/img]
选择“角色”点右边的添加角色
[img]http://files.jb51.net/file_images/article/201303/1389.jpg[/img]
下一步
[img]http://files.jb51.net/file_images/article/201303/1390.jpg[/img]
选择“Web服务器(IIS)”,下一步
[img]http://files.jb51.net/file_images/article/201303/1391.jpg[/img]
下一步
[img]http://files.jb51.net/file_images/article/201303/1392.jpg[/img]
确保“CGI”被选中,其他的角色服务可根据自己的需要勾选
这里全部勾选
下一步
[img]http://files.jb51.net/file_images/article/201303/1393.jpg[/img]
安装
[img]http://files.jb51.net/file_images/article/201303/1394.jpg[/img]
正在安装
[img]http://files.jb51.net/file_images/article/201303/1395.jpg[/img]
关闭,在浏览器里面打开http://localhost/
出现下面的界面
[img]http://files.jb51.net/file_images/article/201303/1396.jpg[/img]
IIS7.5安装完成
[b]二、安装Microsoft Visual C++ 2010 可再发行组件包 (x64) [/b]
双击打开vcredist_x64.exe
[img]http://files.jb51.net/file_images/article/201303/1397.jpg[/img]
[img]http://files.jb51.net/file_images/article/201303/1398.jpg[/img]
选中“我已阅读并接受许可条款”,点安装
[img]http://files.jb51.net/file_images/article/201303/1399.jpg[/img]
正在安装
[img]http://files.jb51.net/file_images/article/201303/1400.jpg[/img]
完成
[b]三、安装Microsoft .NET Framework 4(独立安装程序)[/b]
双击dotNetFx40_Full_x86_x64.exe
[img]http://files.jb51.net/file_images/article/201303/1401.jpg[/img]
选中“我已阅读并接受许可条款”,点安装
[img]http://files.jb51.net/file_images/article/201303/1402.jpg[/img]
[img]http://files.jb51.net/file_images/article/201303/1403.jpg[/img]
正在安装
[img]http://files.jb51.net/file_images/article/201303/1404.jpg[/img]
点完成,安装完毕。
[b]四、安装MySQL[/b]
双击打开mysql-installer-5.5.25.0
[img]http://files.jb51.net/file_images/article/201303/1405.jpg[/img]
[img]http://files.jb51.net/file_images/article/201303/1406.jpg[/img]
选择第一项Install MySQL Products(安装MySQL)
[img]http://files.jb51.net/file_images/article/201303/1407.jpg[/img]
选中“I accept the license terms”(我接受许可条款),点Next
[img]http://files.jb51.net/file_images/article/201303/1408.jpg[/img]
选中“Skip the check for update (not recommended)”(跳过检查更新),点Next
[img]http://files.jb51.net/file_images/article/201303/1409.jpg[/img]
选中“Custom”(自定义安装),Installation Path(安装路径):D:\Program Files\MySQL
Next
[img]http://files.jb51.net/file_images/article/201303/1410.jpg[/img]
确保“MySQL Server5.5.25”被选中,点Next(其他的组件可以选择安装)
这里全部选中,安装所有组件
[img]http://files.jb51.net/file_images/article/201303/1411.jpg[/img]
Execute (执行)
[img]http://files.jb51.net/file_images/article/201303/1412.jpg[/img]
选中“我已阅读并接受许可条款”
点安装
[img]http://files.jb51.net/file_images/article/201303/1413.jpg[/img]
完成
[img]http://files.jb51.net/file_images/article/201303/1414.jpg[/img]
Next
[img]http://files.jb51.net/file_images/article/201303/1415.jpg[/img]
Execute (执行)
[img]http://files.jb51.net/file_images/article/201303/1416.jpg[/img]
Next
[img]http://files.jb51.net/file_images/article/201303/1417.jpg[/img]
Next
[img]http://files.jb51.net/file_images/article/201303/1418.jpg[/img]
Developer Machine(开发服务器)
Server Machine(普通服务器)
Dedicated Machine(专用服务器)
这里选择第二项: Server Machine(普通服务器)
点Next
[img]http://files.jb51.net/file_images/article/201303/1419.jpg[/img]
勾选“Enable TCP/IP Networking”(开启TCP网络端口)
Port Number(端口):3306
勾选“Create Windows Service”(创建Windows系统服务)
Windows Server Name(Windows服务名):MySQL55
MySQL Root password:输入密码
Repeat Password:重复输入密码
设置好之后,点Next
[img]http://files.jb51.net/file_images/article/201303/1420.jpg[/img]
Next
[img]http://files.jb51.net/file_images/article/201303/1421.jpg[/img]
Next
[img]http://files.jb51.net/file_images/article/201303/1422.jpg[/img]
点Finish(完成)
[img]http://files.jb51.net/file_images/article/201303/1423.jpg[/img]
关闭此窗口
[img]http://files.jb51.net/file_images/article/201303/1424.jpg[/img]
打开MySQL安装路径
D:\Program Files\MySQL\MySQL Server 5.5
复制my-huge.ini为my.ini
备份my-huge.ini为my-huge.ini_bak
[img]http://files.jb51.net/file_images/article/201303/1425.jpg[/img]
开始-所有程序-MySQL-MySQL Server 5.5- Mysql Command Line Client
[img]http://files.jb51.net/file_images/article/201303/1426.jpg[/img]
输入安装时候的MySQL root账号密码,回车
[img]http://files.jb51.net/file_images/article/201303/1427.jpg[/img]
登录成功,MySQL安装完成。
[b]五、安装Microsoft Visual C++ 2008 Redistributable Package (x86)[/b]
双击打开vcredist_x86.exe
[img]http://files.jb51.net/file_images/article/201303/1428.jpg[/img]
下一步
[img]http://files.jb51.net/file_images/article/201303/1429.jpg[/img]
勾选“我已阅读并接受许可条款”
点安装
[img]http://files.jb51.net/file_images/article/201303/1430.jpg[/img]
完成
[b]六、安装PHP[/b]
解压php-5.4.4-nts-Win32-VC9-x86.zip文件
[img]http://files.jb51.net/file_images/article/201303/1431.jpg[/img]
[img]http://files.jb51.net/file_images/article/201303/1432.jpg[/img]
重命名文件夹为php,把php文件夹拷贝到D盘根目录
[img]http://files.jb51.net/file_images/article/201303/1433.jpg[/img]
解压ZendGuardLoader-php-5.3-Windows.zip
[img]http://files.jb51.net/file_images/article/201303/1434.jpg[/img]
打开
D:\soft\ZendGuardLoader-php-5.3-Windows\ZendGuardLoader-php-5.3-Windows\php-5.3.x
把里面的ZendLoader.dll文件拷贝到D:\php\ext目录中
[img]http://files.jb51.net/file_images/article/201303/1435.jpg[/img]
打开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
[img]http://files.jb51.net/file_images/article/201303/1436.jpg[/img]
在最后一行添加以下代码
[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"
[img]http://files.jb51.net/file_images/article/201303/1437.jpg[/img]
最后,保存退出
[b]七、配置IIS支持PHP[/b]
开始-管理工具- Internet 信息服务(IIS)管理器
[img]http://files.jb51.net/file_images/article/201303/1438.jpg[/img]
双击左边“起始页”下面的计算机名称
找到中间的IIS部分,打开“处理程序映射”
[img]http://files.jb51.net/file_images/article/201303/1439.jpg[/img]
点右边的“添加模块映射”
[img]http://files.jb51.net/file_images/article/201303/1440.jpg[/img]
请求路径:*.php
模块:FastCgiModule
可执行文件(可选):D:\php\php-cgi.exe
名称:FastCGI
最后,确定
[img]http://files.jb51.net/file_images/article/201303/1441.jpg[/img]
点“是”
[img]http://files.jb51.net/file_images/article/201303/1442.jpg[/img]
双击左边“起始页”下面的计算机名称
找到中间的IIS部分,打开“FastCGI设置”
[img]http://files.jb51.net/file_images/article/201303/1443.jpg[/img]
右键选中:D:\php\php-cgi.exe然后选择编辑
[img]http://files.jb51.net/file_images/article/201303/1444.jpg[/img]
监视对文件所做的更改:D:\php\php.ini
[img]http://files.jb51.net/file_images/article/201303/1445.jpg[/img]
环境变量,点旁边的安装
[img]http://files.jb51.net/file_images/article/201303/1446.jpg[/img]
点“添加”
[img]http://files.jb51.net/file_images/article/201303/1447.jpg[/img]
Name:PHP_FCGI_MAX_REQUESTS
Value:10000
确定
[img]http://files.jb51.net/file_images/article/201303/1448.jpg[/img]
确定
[b]测试篇[/b]
打开:
C:\inetpub\wwwroot
新建一个index.php文件
内容如下:
<?php
Phpinfo();
?>
最后,保存退出
[img]http://files.jb51.net/file_images/article/201303/1449.jpg[/img]
在浏览器里面打开http://localhost/
出现下面的界面,说明配置成功!
[img]http://files.jb51.net/file_images/article/201303/1450.jpg[/img]
[b]至此,Windows Server 2008 R2 IIS7.5+PHP5(FastCGI)+MySQL5环境搭建教程完成。[/b]