search
HomeTopicsIISIntroduction to configuring php server on IIS
Introduction to configuring php server on IISFeb 20, 2021 am 09:34 AM
iisConfigure php

Introduction to configuring php server on IIS

Recommended (free): IIS

1. Download php interpreter

The address is http://windows.php.net/download/

There are two versions, thread-safe and non-thread-safe. Thread-safe is for apache, and non-thread-safe. It is for iis. What we want to configure is iis, so download the non-thread-safe version. For x86 and x64, you can choose the corresponding version to download depending on the system of your machine.

2. Install the PHP interpreter In the system disk, then put the E:\PHP)

folder, even if the installation is completed.

3. Configure php.ini

Copy php.ini-development, rename it to php.ini, and make the following modifications:

The path of the extension plug-in

; Directory in which the loadable extensions (modules) reside.
; http://php.net/extension-dir
; extension_dir = "./"
; On windows:
 extension_dir = "c:\PHP\ext"

Modify the last line and fill in your real PHP interpreter address, followed by the ext folder, which contains all plug-ins

; 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_fileinfo.dll
;extension=php_gd2.dll
;extension=php_gettext.dll
;extension=php_gmp.dll
;extension=php_intl.dll
;extension=php_imap.dll
;extension=php_interbase.dll
;extension=php_ldap.dll
extension=php_mbstring.dll
;extension=php_exif.dll      ; Must be after mbstring as it depends on it
extension=php_mysql.dll
extension=php_mysqli.dll
;extension=php_oci8_12c.dll  ; Use with Oracle Database 12c Instant Client
;extension=php_openssl.dll
;extension=php_pdo_firebird.dll
;extension=php_pdo_mysql.dll
;extension=php_pdo_oci.dll
;extension=php_pdo_odbc.dll
;extension=php_pdo_pgsql.dll
;extension=php_pdo_sqlite.dll
;extension=php_pgsql.dll
;extension=php_shmop.dll
For the plug-ins to be introduced, just remove the semicolon in front of it. I only introduced mysql, mysqli, and mbstring here.

Set time zone

[Date]
; Defines the default timezone used by the date functions
; http://php.net/date.timezone
date.timezone = Asia/Shanghai

Support short tags

; This directive determines whether or not PHP will recognize code between
; <? and ?> tags as PHP source which should be processed as such. It is
; generally recommended that <?php and ?> should be used and that this feature
; should be disabled, as enabling it may result in issues when generating XML
; documents, however this remains supported for backward compatibility reasons.
; Note that this directive does not control the <?= shorthand tag, which can be
; used regardless of this directive.
; Default Value: On
; Development Value: Off
; Production Value: Off
; http://php.net/short-open-tag
short_open_tag = On

Enable 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.
; http://php.net/fastcgi.impersonate
fastcgi.impersonate = 1

cgi related settings pathinfo

; cgi.fix_pathinfo provides *real* PATH_INFO/PATH_TRANSLATED support for CGI.  PHP&#39;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 its 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.
; http://php.net/cgi.fix-pathinfo
cgi.fix_pathinfo=1

cgi related settings 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.**
; http://php.net/cgi.force-redirect
cgi.force_redirect = 0

session storage path

; where MODE is the octal representation of the mode. Note that this
; does not overwrite the process&#39;s umask.
; http://php.net/session.save-path
session.save_path = "d:\server\web\session"

database

mysql.default_port = 3306

mysql.default_host = localhost

mysql.default_user = root

Output cache

; Note: This directive is hardcoded to Off for the CLI SAPI
; Default Value: Off
; Development Value: 4096
; Production Value: 4096
; http://php.net/output-buffering
output_buffering = On//这里应该是填一个值,比如4096

Limit the maximum upload file size Value
upload_max_filesize = 100M

Hide php version

Change On to Off, the php version will not be displayed in the header

expose_php = Off

4. Change php .ini is placed in the system directory

After the configuration is completed, place a copy of php.ini under c:\windows. Note that if you are using iis7 with win7, you no longer need to

do this.

5. Configure IIS (IIS has been installed by default, and I will not introduce how to install IIS here) HandlerMappings )

After clicking OK, a pop-up will appear A warning dialog box, just click "Yes".

Note: The FastCgiModule module may not be available at the beginning. To turn on or off windows features - web server IIS - add role service - check CGI to install.

ISAPI and CGI restrictions

# Add a site

Create a folder under a certain path, add the site in IIS, and add this folder as a site

##Note that after adding a site, you need to add the everyone user to it and give it full permissions.

Set the site default page

##Add a default page

Create a file named index.php in the root directory of the website, enter

<?php phpinfo(); ?>

Open the website

Configure hosts to point, point the website domain name just configured to 127.0.0.1, like this:

127.0.0.1 yourdomain.com
Open yourdomain.com in the browser, you can see that the index.php file has been successfully parsed, and the display is php related information.

有可能出现的错误:访问可能出现“FastCGI进程意外退出500错误”。默认已经有一个网站占用了所有端口,现在我们又添加一个网站可能导致冲突,把默认那个网站停止就可以了。

6、集成CodeIgniter框架

下载CodeIgniter

下载地址:http://codeigniter.org.cn/

整合CodeIgniter

解压之后,打开CodeIgniter文件夹,将里面的内容复制粘贴到站点的根目录,会提示是否替换掉原来的index.php文件,选择"是",这样框架就算整合完毕了

打开浏览器访问主页,看到的是CodeIgniter框架的提示信息!

添加favicon图标

每个page都会自动去加载favicon图标,因此应该在index.php目录下放置favicon.ico文件,不然都会报错,显示找不到图标。

7、有可能出现的问题

丢失 MSVCR110.dll

第一次访问php网站可能会出现“无法启动此程序,因为计算机中丢失 MSVCR110.dll”的错误,应该这样解决:

-打开微软下载页面:http://www.microsoft.com/zh-CN/download/details.aspx?id=30679

-点击下载

-选择相应的版本,64就选64,32就选32

-点击下载

-安装

完成之后网站就可以正常访问了。

唯一密钥属性“value”设置…无法添加类型为add

在web.config-files节点改为:

            <files>
 <clear />
                 <add value="index.php" />
 <add value="index.html" />
             </files>

服务器部署中常见问题

服务器碰见了一些问题 ,一个就是上面说的value属性,value设置好之后就是cgi问题,没有权限之类的,把php引擎的文件夹设置everyone之后,发现cgi意外退出,直接打开cgi,发现原来是丢失 MSVCR110.dll,把丢失 MSVCR110.dll装上之后好了。

注意,因为把system和application文件夹移到web目录以外,但是程序在访问的时候仍然会访问到这两个文件夹,因此也要把这两个文件夹添加everyone。

升级php7遇到的问题

升级php7传说中性能可以提升很多倍。php5竟然是10多年前的产物...

配置php.ini没碰到什么问题,主要一个是mysql.dll的选项没了,配置数据库的port、username等都不是mysql而是mysqli,这些我就没弄了,在CI里面会有配置,应该没什么大问题。

开始运行,cgi异常。直接打开cgi发现报错:丢失VCRUNTIME140.dll。这个错误是因为最新版的php7(php7.1)需要安装Visual C++Redistributable 2015。

下载地址:https://www.microsoft.com/en-US/download/details.aspx?id=48145,下载安装就好了。

最便捷的解决方案

今天调试刚买的服务器,发现无论怎么弄都会报FastCgi错误,错误代码是***0005,即5号代码的错误。怎么弄都不行,一度怀疑此云服务器的FastCgiModule被阉割了,不能正常运行。

直到找到了这样一个解决方案,https://php.iis.net,可以在线安装。踏破铁鞋无觅处,得来全不费功夫。

8、在本地配置https

本地测试为了可以跟线上一致,以https来测试,必须要配置ssl证书。

The above is the detailed content of Introduction to configuring php server on IIS. For more information, please follow other related articles on the PHP Chinese website!

Statement
This article is reproduced at:CSDN. If there is any infringement, please contact admin@php.cn delete
Windows安装nginx1.10.1反向代理访问IIS网站的方法Windows安装nginx1.10.1反向代理访问IIS网站的方法May 23, 2023 pm 05:40 PM

首先去官网下载软件包,解压,路径最好不要有中文nginx配置的路径问题由于在windows下文件路径可以用”\”,也可以用”\\”,也可以用”/”作为路径做分隔符。但”\”最容易引发问题,所以要尽量避免使用。不要添加path,否则会引发错误,config文件路径找不到比如我解压在e盘cmd命令定位到nginx.exe所在文件夹cde:\worksoftware\nginx-1.10.1然后执行,首先保证nginx.conf文件配置没问题其实nginx最重要的和最主要的工作就是配置文件,其他没什么

iis在linux上可以用吗iis在linux上可以用吗Mar 23, 2023 am 09:24 AM

iis不可以在linux上使用,因为iis是由微软公司提供的基于运行Microsoft Windows的互联网基本服务,是在Windows操作系统平台下开发的,所以限制了它只能在Windows操作系统下运行。

进程无法访问 Windows 11 / 10 上的文件错误修复进程无法访问 Windows 11 / 10 上的文件错误修复May 12, 2023 pm 07:10 PM

众所周知,当任何文件正在使用时,任何其他进程都无法访问/更改它。在这种情况下,当一个进程试图打开一个文件时,操作系统会锁定该文件以防止它被另一个进程修改。“该进程无法访问该文件,因为它正被另一个进程使用”是许多用户在其Windows计算机上观察到的此类错误消息。已知此错误发生在不同版本的WindowsOS和WindowsServer中。通常,在用户的WindowsPC上使用Netsh命令期间会观察到此错误消息。发生此错误的另一种情况是尝试在Internet信息服务(IIS)M

iis应用程序池怎么打开iis应用程序池怎么打开Apr 09, 2024 pm 07:48 PM

要在 IIS 中打开应用程序池:1. 打开 IIS 管理器;2. 导航到 "应用程序池" 节点;3. 右键单击目标应用程序池并选择 "管理";4. 单击 "高级设置" 选项卡;5. 应用程序池配置可在此查看和修改。

php站用iis乱码而apache没事怎么解决php站用iis乱码而apache没事怎么解决Mar 23, 2023 pm 02:48 PM

​在使用 PHP 进行网站开发时,你可能会遇到字符编码问题。特别是在使用不同的 Web 服务器时,会发现 IIS 和 Apache 处理字符编码的方法不同。当你使用 IIS 时,可能会发现在使用 UTF-8 编码时出现了乱码现象;而在使用 Apache 时,一切正常,没有出现任何问题。这种情况应该怎么解决呢?

iis无法启动怎么解决iis无法启动怎么解决Dec 06, 2023 pm 05:07 PM

iis无法启动的解决办法:1、检查系统文件完整性;2、检查端口占用情况;3、启动相关服务;4、重新安装IIS;5、重置Windows系统;6、检查元数据库文件;7、检查文件权限;8、更新操作系统和应用程序;9、避免安装过多不必要的软件;10、定期备份重要数据。详细介绍:1、检查系统文件完整性,运行系统文件检查工具,检查系统文件的完整性等等。

iis无法启动解决方法iis无法启动解决方法Oct 24, 2023 pm 03:04 PM

解决方法:1、检查IIS服务是否已安装;2、检查依赖服务;3、检查端口冲突;4、检查配置文件和权限;5、重新注册IIS相关组件;6、检查日志文件。

iis的日志文件可以删除吗怎么删iis的日志文件可以删除吗怎么删Apr 09, 2024 pm 07:45 PM

是的,可以删除 IIS 日志文件。删除方法包括:通过 IIS 管理器选择网站或应用程序池,然后在“日志文件”选项卡中删除相应日志文件。使用命令提示符转到日志文件存储目录(通常为 %SystemRoot%\System32\LogFiles\W3SVC1),并使用 del 命令删除日志文件。使用第三方工具(例如 Log Parser)自动删除日志文件。

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
Repo: How To Revive Teammates
1 months agoBy尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

SAP NetWeaver Server Adapter for Eclipse

SAP NetWeaver Server Adapter for Eclipse

Integrate Eclipse with SAP NetWeaver application server.

EditPlus Chinese cracked version

EditPlus Chinese cracked version

Small size, syntax highlighting, does not support code prompt function

Dreamweaver Mac version

Dreamweaver Mac version

Visual web development tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

VSCode Windows 64-bit Download

VSCode Windows 64-bit Download

A free and powerful IDE editor launched by Microsoft