首页 > 数据库 >Windows Server 2012 R2上PHP、MySQL环境搭建

Windows Server 2012 R2上PHP、MySQL环境搭建

时间:2023-01-03 11:32:56浏览次数:65  
标签:PHP IIS R2 Windows Server Visual MySQL download php

一、准备工具
服务器操作系统:Windows Server 2012
PHP版本:5.6.9(根据自己需要)
MySQL版本:MySQL8.0.17

二、相关软件下载
1、PHP下载
​​​https://windows.php.net/downloads/releases/archives/​​​

2、MySQL下载
​​​https://dev.mysql.com/downloads/installer/​​​

3、Visual C++ Redistributable for Visual Studio 2012 Update 4(x64)下载地址(安装PHP需要此插件)
​http://download.microsoft.com/download/9/C/D/9CD480DC-0301-41B0-AAAB-FE9AC1F60237/VSU4/vcredist_x64.exe

4、Visual C++ Redistributable for Visual Studio 2012 Update 4(x86)下载地址(安装PHP需要此插件)

​http://download.microsoft.com/download/9/C/D/9CD480DC-0301-41B0-AAAB-FE9AC1F60237/VSU4/vcredist_x86.exe​

5、Microsoft Visual C++ 2010 可再发行组件包 (x86)下载地址(安装MySQL需要此插件)
http://download.microsoft.com/download/5/B/C/5BC5DBB3-652D-4DCE-B14A-475AB85EEF6E/vcredist_x86.exe

6、Microsoft URL 重写模块 2.0下载地址(IIS8.5伪静态需要此插件)http://download.microsoft.com/download/4/E/7/4E7ECE9A-DF55-4F90-A354-B497072BDE0A/rewrite_x64_zh-CN.msi


一、安装IIS

Windows Server 2012 R2上PHP、MySQL环境搭建_IIS

服务器角色:勾选Web服务器(IIS)弹出对话框选择添加功能下一步

Windows Server 2012 R2上PHP、MySQL环境搭建_IIS_02

角色服务:Web服务器全部勾选上(特别是CGI必须勾选上)下一步

Windows Server 2012 R2上PHP、MySQL环境搭建_IIS_03

最后确认安装,关闭软件。
验证:在浏览器输入127.0.0.1,看到方格界面就算成功了。


二、安装PHP

3、配置IIS支持PHP
打开:控制面板-系统和安全-管理工具-Internet Information Services(IIS)管理器→
双击左边“起始页”下面的计算机名称→找到中间的IIS部分,打开“处理程序映射”

Windows Server 2012 R2上PHP、MySQL环境搭建_php_04

点击右边的“添加模块映射”→请求路径:*.php→模块:FastCgiModule→可执行文件(可选):文件所在盘\php-cgi.exe→名称

Windows Server 2012 R2上PHP、MySQL环境搭建_PHP_05

FastCGI设置→选中右击编辑→监视对文件所做的更改:所在盘\php.ini→环境变量→添加Name:PHP_FCGI_MAX_REQUESTS和Value:1000

默认文档→添加一个index.php文件

Windows Server 2012 R2上PHP、MySQL环境搭建_IIS_06

4、测试PHP程序是否正常运行
打开:
C:\inetpub\wwwroot
新建一个index.php文件
内容如下:
<?php
phpinfo();
?>
在浏览器里面打开http://127.0.0.1/
出现关于php的界面,说php程序可以正常运行。


三、安装MySQL

Windows Server 2012 R2上PHP、MySQL环境搭建_php_07

Windows Server 2012 R2上PHP、MySQL环境搭建_PHP_08

Windows Server 2012 R2上PHP、MySQL环境搭建_IIS_09

Windows Server 2012 R2上PHP、MySQL环境搭建_IIS_10

Windows Server 2012 R2上PHP、MySQL环境搭建_IIS_11

Windows Server 2012 R2上PHP、MySQL环境搭建_php_12

Windows Server 2012 R2上PHP、MySQL环境搭建_IIS_13

Windows Server 2012 R2上PHP、MySQL环境搭建_PHP_14

Windows Server 2012 R2上PHP、MySQL环境搭建_IIS_15

Windows Server 2012 R2上PHP、MySQL环境搭建_IIS_16

Windows Server 2012 R2上PHP、MySQL环境搭建_PHP_17

Windows Server 2012 R2上PHP、MySQL环境搭建_php_18

Windows Server 2012 R2上PHP、MySQL环境搭建_php_19

四、配置IIS支持伪静态
安装重写模块
在:控制面板\系统和安全\管理工具\Internet Information Services (IIS)管理器中可以看到”URL重写“
在:网站根目录下新建文件web.config,添加伪静态规则代码即可实现网站静态化

标签:PHP,IIS,R2,Windows,Server,Visual,MySQL,download,php
From: https://blog.51cto.com/kele/5984801

相关文章