首页 技术文章 后端开发 一文详解IIS10是怎么配置PHP的
正文 评论

一文详解IIS10是怎么配置PHP的

笔记不支持上传图片,记成文章了

首先 安装IIS时,找到万维网服务--应用程序开发功能,以下3项要勾选:CGI ISAPI扩展 IASPI筛选器

1.先安装php

http://windows.php.net/download/

我装是的phpstudy集成环境,用的里面的php5.2

2.配置php.ini 拷贝php.ini-development,改名为php.ini,并进行如下修改

2.1 扩展插件的路径

; Directory in which the loadable extensions (modules) reside.
extension_dir ="D:\\phpStudy\\php52\\ext"

填入自己真实的PHP解释器地址,以及后面跟着ext文件夹,这个里面放的都是插件

2.2 设置要引入哪些插件

; Windows Extensions
; Note that ODBC support is built in, so no dll is needed for it.
; Note that many DLL files are located in the extensions/ (PHP 4) ext/ (PHP 5)
; extension folders as well as the separate PECL DLL download (PHP 5).
; Be sure to appropriately set the extension_dir directive.

extension=php_bz2.dll
extension=php_curl.dll
;extension=php_dba.dll
;extension=php_dbase.dll
;extension=php_fdf.dll
extension=php_gd2.dll
;extension=php_gettext.dll
;extension=php_gmp.dll
;extension=php_ifx.dll
;extension=php_imap.dll
;extension=php_interbase.dll
;extension=php_ldap.dll
extension=php_mbstring.dll
;extension=php_exif.dll
extension=php_mcrypt.dll
;extension=php_mhash.dll
;extension=php_mime_magic.dll
;extension=php_ming.dll
;extension=php_msql.dll
;extension=php_mssql.dll
extension=php_mysql.dll
extension=php_mysqli.dll
;extension=php_oci8.dll
;extension=php_openssl.dll
extension=php_pdo.dll
;extension=php_pdo_firebird.dll
;extension=php_pdo_mssql.dll
extension=php_pdo_mysql.dll
;extension=php_pdo_oci.dll
;extension=php_pdo_oci8.dll
extension=php_pdo_odbc.dll
;extension=php_pdo_pgsql.dll
extension=php_pdo_sqlite.dll
;extension=php_pgsql.dll
;extension=php_pspell.dll
;extension=php_shmop.dll
;extension=php_snmp.dll
;extension=php_soap.dll
;extension=php_sockets.dll
extension=php_sqlite.dll
;extension=php_sybase_ct.dll
;extension=php_tidy.dll
;extension=php_xmlrpc.dll
;extension=php_xsl.dll
extension=php_zip.dll
;extension=php_mongo.dl
;extension=php_sqlsrv.dll
;extension=php_pdo_sqlsrv.dll
;extension=php_ibm_db2.dll
;extension=memcache.dll

2.3 设置时区

[Date]
; Defines the default timezone used by the date functions
date.timezone = PRC

改成
date.timezone = Asia/Shanghai

2.4 启用fastcgi

; FastCGI under IIS (on WINNT based OS) supports the ability to impersonate
; security tokens of the calling client.  This allows IIS to define the
; security context that the request runs under.  mod_fastcgi under Apache
; does not currently support this feature (03/17/2002)
; Set to 1 if running under IIS.  Default is zero.
 fastcgi.impersonate = 1;

2.5 cgi相关设置pathinfo

; cgi.fix_pathinfo provides *real* PATH_INFO/PATH_TRANSLATED support for CGI.  PHP's
; previous behaviour was to set PATH_TRANSLATED to SCRIPT_FILENAME, and to not grok
; what PATH_INFO is.  For more information on PATH_INFO, see the cgi specs.  Setting
; this to 1 will cause PHP CGI to fix it's paths to conform to the spec.  A setting
; of zero causes PHP to behave as before.  Default is 1.  You should fix your scripts
; to use SCRIPT_FILENAME rather than PATH_TRANSLATED.
 cgi.fix_pathinfo=0

2.6 cgi相关设置redirect

; cgi.force_redirect is necessary to provide security running PHP as a CGI under
; most web servers.  Left undefined, PHP turns this on by default.  You can
; turn it off here AT YOUR OWN RISK
; **You CAN safely turn this off for IIS, in fact, you MUST.**
 cgi.force_redirect = 0

IIS 官网 https://www.iis.net 还说了开启错误日志,我没有开启。

Set error_log="C:php_errors.log"
This can help with troubleshooting.

这是官网的配置php说明
https://www.iis.net/learn/app...
微软官方的技术资源库中文相关文档
https://technet.microsoft.com...

3.配置IIS,安装IIS时,以下3项要勾选:CGI ISAPI扩展 IASPI筛选器

一文详解IIS10是怎么配置PHP的

3.1 找到处理程序映射,添加模块映射
都点击确定之后,会弹出一个警告对话框,点击“是”就可以了,由于已经添加好了,这里找到添加的模块截的图

一文详解IIS10是怎么配置PHP的

一文详解IIS10是怎么配置PHP的

一文详解IIS10是怎么配置PHP的

3.2 找到ISPAI和CGI限制,点右边的添加。这里截图是添加好的

一文详解IIS10是怎么配置PHP的

一文详解IIS10是怎么配置PHP的

3.3 找到ISPAI筛选器,点击右边的添加,这里同样是添加好的截图

一文详解IIS10是怎么配置PHP的

一文详解IIS10是怎么配置PHP的

3.4 添加默认文档

一文详解IIS10是怎么配置PHP的

一文详解IIS10是怎么配置PHP的

之后新建一个站点用以测试,在添加的站点根目录下新建index.php,输入<?php phpinfo(); ?> 保存,接着浏览网站,会看到phpinfo信息了

一文详解IIS10是怎么配置PHP的

一文详解IIS10是怎么配置PHP的

推荐学习:《PHP视频教程》

以上就是一文详解IIS10是怎么配置PHP的的详细内容,更多请关注主题君其它相关文章!

-=||=-收藏赞 (0)
更多主题
单栏极简文艺WordPress博客主题:Diaspora主题
¥ 0 关注:20,335
详情
简约黑白WordPress个人博客主题:Personal主题
¥ 0 关注:20,182
详情
v1.0.0
小程序收录免费WordPress主题:XCX主题
¥ 0 关注:19,956
详情
v1.0.0
一款简约单栏的免费WordPress博客主题:itheme主题
¥ 0 关注:18,219
详情
功能丰富切轻量的WordPress虚拟资源主题:Rizhuti主题
¥ 599 关注:18,174
详情
大气优雅免费WordPress博客主题:HONEY主题
¥ 0 关注:15,001
详情
回复
暂无评论

不要再留垃圾评论了,主题君整理资源不容易,留几句鼓励的话吧。