Windows2016的 IIS中配置PHP7运行环境
在Windows 的IIS(8.0)中搭建PHP运行环境:
一:安装IIS服务器
.进入控制面板>>程序和功能>>打开或关闭Windows 功能,找到Internet信息服务,记得选中CGI这一项

.安装完成后在浏览器中打开localhost,查看是否能显示IIS的欢迎页面:

二:下载安装配置PHP环境
、下载PHP,官网地址:http://windows.php.net/download/,
、将下载的zip压缩包解压到D盘下,解压后为E:\php-7.0.;
、进入控制面板>>管理工具>>Internet信息服务(IIS)管理器;
、中间窗口选择“处理程序映射”双击,然后最右边选择“添加模块映射”


.“可执行文件”一栏找到PHP的安装目录E:\php,右下角的文件类型改为“exe”即可看到“php-cgi.exe”文件出现了




.然后可以给网站添加默认文档:default.php和index.php。


还要进行下面的配置:
.进入E:\php目录,重命名文件php.ini-development改名为php.ini并复制到桌面;

.下面需要修改桌面的php.ini文件,
打开php.ini文件后,使用快捷键ctrl+F搜索date.timezone修改为date.timezone="Asia/Shanghai”即修改当前的时区
激活你需要的扩展选项,即将相应dll语句前的分号”;”删除
extension=php_gd2.dll
extension=php_mbstring.dll
extension=php_mysql.dll
extension=php_pdo_mysql.dll

再搜索extension_dir=将其修改为extension_dir = “E:\php\ext\”,修改并检查完毕后保存,然后把桌面的这个php.ini文件剪切到C:\Windows目录下即可(为什么开始不直接把文件复制到这里来修改呢,因为Windows 8涉及到权限问题,所以先复制到桌面修改,当然也可以放到其它目录修改)
.php环境配置好了,我们就可以测试一下了,在建立的网站目录下新建一个info.php文件(注意是info.php,不是index.php.txt),内容为”<?php phpinfo();?>“,然后再在浏览器中打开”localhost“,即可出现类似如下界面

备注:(在命令行中进入php安装目录下,输入”php -m“命令可查看已开启的dll扩展模块)
网站程序存放目录:
C:\inetpub\wwwroot