Home >Backend Development >PHP Problem >How to configure php running environment in IIS

How to configure php running environment in IIS

WJ
WJOriginal
2020-06-02 13:07:385189browse

How to configure php running environment in IIS

How to configure the PHP running environment in the IIS environment

##Step one: Download and install the PHP support package
1. To make Windows support PHP, first go to the official website of the PHP language (
http://www.php.net/downloads.php) to download an installation package, the latest version It is 5.4.3, as shown below.

How to configure php running environment in IIS

#2. Unzip the downloaded zip file to C:\php (of course, using this directory is just my habit, you can also change it to another The name must be consistent with the configuration name below). Assuming that the system disk is on the C drive, then we copy C:\php\php5ts.dll to C:\Windows\system32. Then copy C:\php\php.ini-dist to C:\Windows\php.ini. (It should be noted here that the original file name is "php.ini-dist". After copying to the Windows folder, the file name becomes "php.ini", as shown below.)

How to configure php running environment in IIS

3. Then use Notepad to open the "php.ini" file in the Windows folder, change "extension_dir = "./"" to "extension_dir = "C:\php\ext"", and finally save it. Yes, as shown below.

How to configure php running environment in IIS

If you need to use php with mysql, you need to make the following configuration. As shown in the picture:

How to configure php running environment in IIS

1、extension=php_gd2.dll                    '用作gd库支持    
2、extension=php_mbstring.dll            '用作phpmyadmin的溶错(此项可选)
3、extension=php_mysql.dll                 '让php开放支持mysql
配置完以上步骤后,还需将php文件夹下的ext下的php_gd2.dll、php_mbstring.dll、php_mysql.dll三个dll文件复制在C:\windows\system32下既可

Step 2: Configure PHP in IIS

Select Start Menu->Programs-> Management Tools -> Internet Information Services (IIS) Manager, and then click "Add a new Web Service Extension" in "Web Service Extension", as shown below.

How to configure php running environment in IIS

The "New Web Service Extension" window will appear. Enter "php" in the "Extension Name", then click the "Add" button inside and add C:\ Ricky\php-5.1.2-Win32\php5isapi.dll is added to it. Note that the file cannot be mistaken. It is "php5isapi.dll", not the "php5ts.dll" we mentioned above. Finally, check "Set extension status to running" (that is, enable support for PHP files) and confirm, as shown below. You can now see the item you just added in the Web Services Extensions list. As shown below

How to configure php running environment in IIS

How to configure php running environment in IIS

After the above settings are completed, we still need to set the properties of the website. Open Internet Information Services (IIS) Manager->Local Computer->Website->Default Website. Right-click the default website and select Properties in the right-click menu. The website's property settings window will appear. Then we select the "Home Directory" tab and click the "Configure" button inside, as shown below.

How to configure php running environment in IIS

Finally, we click the "Add" button in the "Application Configuration" window, enter "php" in "Extension", and add "php" in "Executable File" The C:\Ricky\php-5.1.2-Win32\php5isapi.dll mentioned above is added to it, as shown below.

How to configure php running environment in IIS

Part 3 Verify whether the installation is successful

After some hard work before, we can use the following method to Test whether the PHP running environment is successful. First, run Notepad and enter the following lines of code:

<?php
phpinfo();
?>

How to configure php running environment in IIS

Save it as: C:\Inetpub\wwwroot\test.php file. Then start the browser and visit

http://localhost/text.php. If you see the following screen, the installation is successful! As shown below

How to configure php running environment in IIS

Okay, so far our PHP running environment has been successfully set up

Related references: php中文网

The above is the detailed content of How to configure php running environment in IIS. 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