Home  >  Article  >  Backend Development  >  How to install PHP and IIS server under Win7

How to install PHP and IIS server under Win7

PHPz
PHPzOriginal
2023-04-04 14:00:06500browse

Under the Win7 operating system, most website developers and administrators use IIS (Internet Information Services) server and PHP as the development and operating environment. If you also want to use IIS and PHP under Win7 to develop and test your website, then you need to know how to properly install and configure IIS and PHP. In this article, we will learn how to install IIS and PHP under Win7 operating system.

1. Install the IIS server

  1. First, we need to open the Control Panel and select the Programs and Features option.
  2. Click the "Turn Windows features on or off" link on the left.
  3. In the Windows function window, find the Internet Information Services node and expand it.
  4. Select the Web Management Tool (World Wide Web Services) node and all its sub-nodes below it (if you need to install other IIS support services, you can also select their sub-nodes).
  5. Click the "OK" button and wait for the installation of the IIS server to complete.

2. Install PHP

  1. First, we need to download the latest version of the PHP binary distribution, which can be downloaded from the official website (https://windows.php.net/ download/) to download.
  2. After the download is completed, unzip the downloaded PHP folder to the path you want to install (such as C:\php).
  3. In the unzipped PHP folder, find the php.ini-development file (or php.ini-production file), copy it and rename it to php.ini.
  4. Open the php.ini file and make the following changes:

a. Find the following two lines and uncomment them (remove the preceding semicolon).

extension_dir = "ext"

;extension=php_mysql.dll

b. Find the following two lines and modify them to the relevant configuration information of your MYSQL database (such as IP address, user name, password, etc.).

mysql.default_host = "localhost"

mysql.default_user = "root"

mysql.default_password = ""

c. Find the following two lines and modify them to the relevant configuration information of your SMTP server (such as IP address, port, username, password, etc.).

SMTP = localhost

smtp_port = 25
  1. Add PHP support in IIS

a. Open the IIS management console, find the virtual directory of the corresponding website, and right-click the directory and select "Properties" ".

b. In the properties window, select the "Home" tab and click the "Add" button.

c. In the Add window, enter "index.php" (or the name of your desired PHP file) and click the "OK" button.

d. In the properties window, click the "Configure" button and enter the following information in the "Add" window:

ISAPI或CGI
可执行文件路径:C:\php\php-cgi.exe(或你的PHP解压路径下的php-cgi.exe)
扩展名:.php
MIME类型:application/x-httpd-php

注意:如果你的PHP版本不同,你需要相应地修改可执行文件路径。

e. Click the "OK" button and restart the IIS server.

3. Test PHP

  1. In your Web root directory (such as C:\inetpub\wwwroot), create a file named phpinfo.php, and Enter the following code:

    phpinfo();

    ?>

  2. Open the browser and visit http: //localhost/phpinfo.php, if everything is normal, you will see PHP related information.

Finally, when you successfully install and configure IIS and PHP, you can start writing and testing various types of web applications using PHP under Win7.

The above is the detailed content of How to install PHP and IIS server under Win7. 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