Home>Article>Backend Development> An article explaining in detail how to configure PHP in IIS10

An article explaining in detail how to configure PHP in IIS10

藏色散人
藏色散人 forward
2022-01-29 04:00:31 5494browse

The note does not support uploading images, so it will be recorded as an article

When installing IIS first, find the World Wide Web Service--Application Development function, The following 3 items should be checked: CGI ISAPI extension IASPI filter

1. Install php first

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

I installed the phpstudy integrated environment and used php5.2

2. Configure php.ini, copy php.ini-development, and rename it to php .ini, and make the following modifications

2.1 The path of the extension plug-in

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

Fill in your real PHP interpreter address, followed by the ext folder, which contains all It is a plug-in

2.2 Set which plug-ins to introduce

; 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 Set the time zone

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

changed to
date.timezone = Asia/Shanghai

2.4 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. fastcgi.impersonate = 1;

2.5 cgi related settings 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 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.** cgi.force_redirect = 0

IIS official website https://www.iis.net also said to enable error logs , I didn't turn it on.

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

This is the configuration php instructions of the official website
https://www.iis.net/learn/app...
Microsoft official technical resource library Chinese related documents
https://technet.microsoft.com...

##3. Configure IIS. When installing IIS, the following 3 items must be checked: CGI ISAPI extension IASPI filter

An article explaining in detail how to configure PHP in IIS10

3.1 Find the handler mapping and add the module mapping

After clicking OK, a warning dialog box will pop up, just click "Yes", since it has been added Okay, here is the picture of the added module

An article explaining in detail how to configure PHP in IIS10

An article explaining in detail how to configure PHP in IIS10

An article explaining in detail how to configure PHP in IIS10## 3.2 Find the ISPAI and CGI restrictions and click Add on the right. The screenshots here are the ones that have been added

An article explaining in detail how to configure PHP in IIS10

##3.3 Find the ISPAI filter and click Add on the right. Here are the screenshots that have been added as wellAn article explaining in detail how to configure PHP in IIS10

An article explaining in detail how to configure PHP in IIS10

3.4 Add default documentAn article explaining in detail how to configure PHP in IIS10

An article explaining in detail how to configure PHP in IIS10

Then create a new site for testing. Create index.php in the root directory of the added site. EnterAn article explaining in detail how to configure PHP in IIS10

to save. Then browse the website and you will see the phpinfo information.

An article explaining in detail how to configure PHP in IIS10

An article explaining in detail how to configure PHP in IIS10Recommended study: "

PHP Video Tutorial
"

The above is the detailed content of An article explaining in detail how to configure PHP in IIS10. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:segmentfault.com. If there is any infringement, please contact admin@php.cn delete