Win7下IIS安装PHP环境

Win7下是IIS7的版本,使用 FastCGI跑PHP,安装过程记录如下。

安装IIS7并打开CGI

    在Windows7的控制面板-程序中“打开/关闭Windows功能”,在里面打开IIS,不要忘了打开IIS里的CGI(这个默认是不选的),
如下图(直接用微软的图):

点击“确定”(OK),等待安装完毕。

安装PHP

在“http://windows.php.net/download/”里下载,我下的是php-5.6.9-Win32-VC11-x86,5.3.1的。解压到随便哪个目录里,我放到E:\php目录下,然后配置方式如下:

1、把目录下的php.ini-development改为php.ini,用记事本打开;

2、fastcgi.impersonate=1(并把行首的分号删掉,下同)

3、 cgi.fix_pathinfo=1

4、cgi.force_redirect=0

5、extension_dir="./ext"

6、打开需要的扩展,比如extension=php_mysql.dll

(有的ext目录里没有php_mssql.dll这个文件,可以暂时不打开php_mysql.dll,这样就能顺利通过。)

7、更改时区,date.timezone= Asia/Shanghai    详情参考:http://www.php.net/manual/en/timezones.asia.php

以上几点做完,可以在“开始-运行-cmd”下试着运行E:\php\php -info和E:\php\php -v,正常来说-info参数可以看到php的参数信息,而-v参数可以看到php的版本信息,如dll文件不存在的扩展打开了的话,-v时会有提示。

配置IIS

下面,回到IIS上,打开IIS控制台,在左边树中选最顶级结点,也就是你的电脑名,然后在中间(功能视图)里打开“Handler Mappings”(中文叫“处理程序映射”),如下图:

打开之后在最右边点“添加模块映射”(Add Module Mapping),照下图添加信息:

请求路径:*.php

模块:FastCgiModule

可执行文件:E:\php\php-cgi.exe(选的时候把类型由dll改成exe)

名称:PHP via FastCGI

然后OK,再然后Yes(如图)

重启IIS!

到此,就可以enjoy了,怎么试?

做一个test.php文件,里面的内容是<?php phpinfo(); ?>,然后在浏览器里打localhost/..../text.php。

(这一界面我用我自己的图,以证明我真配成了)

注意事项:

1、安装后入出现FastCGI进程退出或缺少MSVCR110.dll的,

则需要下载Visual C++ Redistributable Package 2012

下载地址:http://www.microsoft.com/zh-CN/download/details.aspx?id=30679

2、PHP Manager

在IIS7上安装php有一个非常方便的IIS插件,PHP Manager for IIS,几乎所有问题都能帮你搞定,只需要将php解压缩到一个位置,然后通过它选择一下php-cig.exe文件就ok,php.ini自动帮你配置,处理程序映射也自动帮你设置,而且还可以非常方便地切换多个php版本。

官方说明文档 如下

Installation

From the Downloads page select the installation package that is appropriate for your target machine. Download and run the installer, which will install and register PHP Manager's binaries with IIS. Note that only IIS versions 7.0 and above are supported. After installation is complete, launch the IIS Manager and find the "PHP Manager" feature:

When opened, the "PHP Manager" feature provides a configuration overview for the PHP installation that is registered with IIS and is currently active. If no PHP is registered with IIS, then the only action that can be performed is the registation of a new PHP version.

Registering PHP with IIS

To register a new PHP version with IIS, first you need to download the zip archive with PHP binaries fromhttp://windows.php.net/ and then extract the files from it into a folder of your choice. Note that you can also install PHP by using Web Platform Installer or the Windows installer from http://windows.php.net/ - the PHP Manager can be used to manage those PHP installations as well.

Click on "Register new PHP version" task and then provide the full path to the location of the main php executable file: php-cgi.exe:

After clicking OK the new PHP version will be registered with IIS and will become active. This means that all the sites on this IIS server by default will use this PHP version.

Validating existing PHP installations and fixing configuration issues

In order for PHP to run properly on IIS there is a set of recommended settings that need to be configured in IIS and PHP. PHP Manager checks if all of the recommended settings are configured correctly. If some settings are not configured properly then you can use PHP Manager to fix those settings.

When some configuration settings are configured incorrectly you will see a warning message when you open PHP Manager:

After clicking on "View Recommendations" link you can see all the configuration issues that exist in your PHP installation. You can review each issue description and the recommended corrective action. You can also select which configuration issues you want to be fixed:

Switching between PHP versions

After multiple PHP versions have been registered with IIS, you can use PHP Manager to easily switch between the versions on a server, site and application levels. This means that you can configure some IIS sites to use one PHP version, while other sites use different version. Also, you can configure separate applications within a web site to use different PHP versions.

Note: When switching the PHP versions on any level except server level, the PHP Manager will make a local copy of all IIS Handlers on that level. This means that if later you make any changes to handler mappings on an upper configuration level, that won't take effect on this configuration level. You can easily determine if the PHP handler is defined locally versus being inherited from an upper configuration level by checking the information on PHP Manager main feature page:

Checking phpinfo() output

phpinfo() function in PHP provides very detailed information about all aspects of PHP runtime configuration. To check the phpinfo() output from within PHP Manager use the "Check phpinfo()" task.

Configuring Error Reporting

You can use PHP Manager to configure error reporting level in PHP. If IIS is used on a development machine then you may want to use verbose error reporting in order to see all the errors, warnings and notices from your PHP application right away. If IIS is used as a production server, then error reporting level is less verbose and errors are logged in a log file, but never communicated to HTTP client.

Configuring Runtime Limits

Various timeouts and limits can be configured in the "PHP Runtime Limits" page:

Configuring All PHP Settings

All existing PHP settings can be added, removed and modified in the "PHP Settings" page.

Enabling or Disabling PHP Extensions

PHP extensions can be enabled or disabled in the "PHP Extensions" page:

Last edited Jun 28, 2011 at 4:42 AM by ruslany, version 3

Win7下IIS安装PHP环境相关推荐

  1. win7下IIS安装教程

    1.打开或关闭windows功能 2.勾选如下选项 3.等待片刻即可,打开管理工具即可查看IIS管理器

  2. win7下怎么安装IIS

    https://jingyan.baidu.com/article/219f4bf723bcb2de442d38ed.html 最近想搭建一个本地asp测试环境,以前是XP的,现在是win7旗舰版的系 ...

  3. win7 安装c语言环境变量,win7下如何配置编程环境变量的方法

    win7下如何配置编程环境变量的方法 由于Win7和Win XP的不同,环境变量的配置也变得有所不同.具体操作: 一.桌面右击[计算机],选择[属性],在弹出的窗体左侧点击[高级系统设置],此时将弹出 ...

  4. iis7怎么搭建php环境,WIN7下iis7支持php环境搭建

    今天想在win7下搭建php环境,由于新接触iis7,所以不是很清楚具体步骤,于是按惯例咨询了下"度娘",找到些零星的教程,在几个教程的整合中终于搞定,于是把整个过程整理下发出来, ...

  5. cocos2d-x在win7下的android交叉编译环境

    cocos2d-x在win7下的android交叉编译环境 前面把Visual Studio+Python开发环境配好了,但还没有讲如何在Android中使用创建好的项目,本篇博客介绍如何在win7下 ...

  6. win7 android 编译环境搭建,在Win7下配置Android开发环境

    在Win7下配置Android开发环境是本文要介绍的内容,主要是来了解并学习Android开发环境,具体关于Android开发环境的详解来看本文. 一.安装 JDK 下载JDK最新版本,下载地址如下: ...

  7. 神灯 Geany 在win7下的安装

    神灯 Geany 在win7下的安装 本文著作权归"春风不醉人"所有 [灵感来源]          笔者在学习c语言时在windows下编写程序用得是VC和TC,感觉用起来手感不 ...

  8. linux怎么离线安装gcc文件夹,CentOS下离线安装gcc环境,图文详细,方法全面

    CentOS下离线安装gcc环境,图文详细,方法全面 下载 方式1:如果有网的虚拟机还没有安装,可以直接 yum install --downloadonly --downloaddir=/root/ ...

  9. Win7下硬盘安装Redhat双系统

    Win7下硬盘安装Redhat Linux 形成双系统过程详解 需要软件 EasyBCD2.0  和 linux ISO 系统镜像 RedHat linux下载地址:http://www.linuxi ...

最新文章

  1. AI一分钟 | 阿里云放大招要揽1000名AI人才,川普AI守国论遭遇54名科学家反对
  2. 【Android 组件化】路由组件 ( 注解处理器获取被注解的节点 )
  3. windows下的虚拟内存分配分析
  4. [Python爬虫] scrapy爬虫系列 一.安装及入门介绍
  5. http抓包实战 pdf_实战 Wireshark https 抓包 2, 再抓 Moka 蹭 OurATS 的小尾巴
  6. gRPC in ASP.NET Core 3.x -- Protocol Buffer, Go语言的例子(下)
  7. 计算机图形学颜色表示,计算机图形学 颜色表示模型.ppt
  8. Python 进阶 之 socket模块
  9. c语言用菜单做计算器,小白求大神帮忙用C语言做个多功能计算器!!!!
  10. 算天数什么时候加一什么时候不加一_陌陌加公会不加公会的区别?
  11. Python中的枚举(enumerate)
  12. python:文件处理之TXT
  13. c均值聚类matlab,实现代码 - 模糊C均值聚类算法(原理+Matlab代码)
  14. NodeMCU ESP8266+Arduino:将宿舍老式门锁改造为简易密码锁
  15. MSP430开发环境配置
  16. 计算机网络——FTP网络服务器
  17. 复化梯形公式matlab程序,复化梯形公式,辛普森公式的matlab程序
  18. 初学Python-反射 装饰器 面向对象编程 异常处理 断言
  19. picker多选 vant_Vant Picker 选择器
  20. ubuntu20编译Gmssl时,“version OPENSSL_1_1_0d not defined”问题的较好解决办法

热门文章

  1. C++“(已隐式声明)--它是已删除的函数 ” “尝试引用已删除的函数”知识点MARK
  2. 有一个已经排好序的数组,要求输入一个数后,按原来排序的规律将它插入数组中
  3. 南京大学计算机考研难度分析,2020考研难度高的院校分析之【南京大学】
  4. 高强度间歇训练(HIIT)
  5. Android中TextView加横线的属性
  6. 今日头条前端三轮面试面经
  7. 有哪些技术可以自动拨打电话
  8. 从项目的一个 panic 说起:Go 中 Sync 包的分析应用
  9. nodejs mysql 耗硬盘_nodejs操作MySQL其实很简单
  10. 该网页无法正常运作解决方法