This article mainly introduces the method of installing PHP extension under IIS, very simple, with reference value, the need for friends can refer to the following
Many online articles in the introduction of IIS under the installation of PHP will involve a lot of configuration changes, in fact, most of them are not necessary, for those who need to find how to install PHP extension, in fact, the most need is a version that can be used now, Introducing too many unnecessary configurations at this time I think is inefficient.
So, in fact, the installation steps only need three steps:
1. Download the PHP file package;
2. Configure PHP;
3. Introduce PHP extensions to IIS;
Of course, there may be a 4th step: testing.
First step: Download PHP
PHP version of Windows is directly provide a compressed package, which includes all the files required to run, it is a fool installation, can be obtained from the Windows download area of the official website, note that there are three points to note when selecting a version:
1. Select the PHP version, Mainly divided into php5.x and php7.x two kinds, according to the need to choose, if it is the beginning, in fact, can be directly from the PHP7, this version introduced a series of Coooooool features and great operational efficiency improvement; If you have a specified framework or project requirements, select the version from the documentation.
2. Choose the processor architecture, mainly refers to X86 and X64, respectively, 32-bit and 64-bit, is written by the 2017, I believe most of the developers of the processor and system are X64 architecture, directly Select this version.
3. Select the thread-safe version, which you can select as needed. ThreadSafe relative to the need to take into account thread safety, so there will be some loss of efficiency, but the loss is small, if the use of fastcgi can be directly selected Non-threadsafe.
All in all, if you have no special needs, I suggest you choose php7.x X64 non-threadsafe (php7,64-bit architecture, non-thread-safe version).
Step Two: Configure PHP
First select a directory decompression, it is recommended that you use the root directory of the hard disk to create a folder, the files are extracted in it. This is because future PHP requests will be made to the CGI program in the specified location, preferably not frequently changed.
Then add this directory ("E:\PHP" in this article) to the Path constant (right-click my Computer = + Properties-Advanced system settings = Advanced tab. Lower-right corner environment variable = system variable =>path), note that you must add ";" before adding. Semicolons are used for segmentation. After adding to the path variable, you can use the contents of the PHP folder without entering the full path and typing the file name directly (you can search the order of the Windows command line retrieval).
Then copy the "php.ini-development" file and rename the copy to "PHP.ini", which is PHP's official PHP configuration, and we don't need to make any changes to the beginner, if your target framework or project requires it, Make changes as required (such as specifying extensions, etc.).
At this point, the PHP configuration is complete.
Step three: Introduce IIS
First open the IIS administration tool and select Process application Mappings.
Select "Add Module Mapping" in the New interface
Fill in the following information:
The first line is to represent which files will be given to PHP processing, fill *.php means that all the files with PHP extension will be given to php-cgi to handle.
The second line represents the type of the module mapping, and if there is no special requirement we choose FastCGI.
The third line represents the location of the processing module, into our PHP decompression directory, select Php-cgi.exe.
The name is only used to mark and can be filled in freely.
When you click OK, you will be asked if you want to add the Allow rule automatically.
At this point, the IIS installation PHP extension ends.
Fourth Step: Test
Create a new test.php file in the default Web site directory, fill in the
<?phpphpinfo ();? >
Then open the browser to access localhost\test.php, displaying the following information indicating that the installation was successful.