Home  >  Article  >  Backend Development  >  What are the steps to set up IIS and install php7.2 under win10 system?

What are the steps to set up IIS and install php7.2 under win10 system?

不言
不言Original
2018-07-26 14:06:462280browse

How to install php7.2 through iis under win10 system? In the following article, I will introduce to you the settings of iis under win10 system and how to install php7.2 through iis. Then, let’s take a look at the installation process of php7.2 in detail.

Turn on IIS and related functions:

Control Panel - Programs and Features - Turn Windows features on or off - Check Select Internet Information Service - World Wide Web Service - Performance and Functions - Check CGI

After successful opening, there will be IIS Manager

## under Computer Management - Services and Referenced Programs #Install and configure php:

Download php from the official website, choose between none thread (non-thread safety) and thread (thread safety) versions:

There are two execution methods of PHP: ISAPI and FastCGI. The FastCGI execution method uses a single thread to perform operations, so there is no need to perform thread safety checks. Removing the protection of thread safety checks can improve execution efficiency. Therefore, if FastCGI (whether paired with IIS 6 or IIS 7) is used to execute PHP, It is recommended to download and execute non-thread safe PHP (PHP binary files have two packaging methods: msi and zip, please download the zip package). The thread safety check is prepared for ISAPI PHP. Because many PHP modules are not thread safe, you need to use Thread Safe PHP.

Since I am using FastCGI below, I downloaded the none thread version.

1. Download and extract it to D:/php

2. Back up php.ini-developer in the D:\php directory and change the file name to php.ini

3. Edit php.ini: (remember to remove the first line comment)

extension_dir = "D:\php\ext"

doc_root = "C:\inetpub\wwwroot"

The value of extension_dir is the ext directory under the PHP installation directory, and the value of doc_root is the home directory set by IIS by default;

4. Set environment variables. Add the following value after Path: D:\php

After configuring here, enter php --help in dos and there should be the correct prompt

5 , IIS Manager Home Page - IIS - Handler Mapping - Add Module Mapping

Verify whether the installation is successful:

In c:\inetpub\ Create a new file hello.php under wwwroot. Input content:

<html> 
  <head> 
    <title>World</title> 
  </head>  <body> 
    <?php echo "Hello world" ?> 
  </body> 
</html>

After saving, open the browser and enter the address: http://localhost/hello.php. If Hello world is displayed on the web page, it means the installation is correct.


We can also view the source code of hello.php on the web page. If there is no php code in the source code, it means the installation is correct.

Possible problems:

The server reports a 505 error because of the lack of visual c 2011

The page displays No input file specified. Reason: If you use the ide that comes with it For the web server, you need to comment out the doc_root = "C:\inetpub\wwwroot" in php.ini

To set the php time zone, modify the date.timezone = "Asia/Shanghai" in php.ini

The wwwroot directory of IIS is on drive C, so you need to manually enable write permission

##Enable the php server system log, php. Set log_errors = On in ini, and set error_log = D:/php/error.log. The error_log("test") in the program will output test to the log file. You can also set display_errors = Off to turn off error echo. To avoid being attacked by hackers due to the paths, database connections, data tables and other information disclosed by these errors.

related suggestion:

How to install IIS, MySQ, nginx, php7.1.7 under Win10?

How to configure the Iis8 php environment under Windows Server 2012 (picture)

The above is the detailed content of What are the steps to set up IIS and install php7.2 under win10 system?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn