How to set up PHP in IIS

PHPz
Release: 2023-04-05 15:46:01
Original
1994 people have browsed it

IIS is a web server from Microsoft and an important part of the Windows operating system. ASP.NET websites and PHP websites can be run on IIS. This article mainly introduces how to set up PHP in IIS.

1. Download the PHP installation package

Before setting up PHP, you need to download the PHP installation package. The latest version of PHP can be downloaded from the PHP official website. After the download is complete, unzip the PHP installation package to your local computer.

2. Configure IIS mapping PHP file

  1. Open Internet Information Services (IIS) Manager.
  2. Find the site you want to configure, right-click on the site and select "Add Application".
  3. In the Add Application dialog box, enter an application alias (for example, "php"), and then specify its application pool and physical path. Click on the Add button.
  4. In the newly created application, click the Request Limits tab. In the Mappings section, click Add mapping, and then add the PHP file extension "*.php".
  5. Specify the PHP-CGI or FastCGI module and enter the script handler mapping to be used when starting the FASTCGI process (FastCGI).
  6. Enter the path to PHP-CGI or FastCGI in the "Handler Path" input box. For example: C:\PHP\php-cgi.exe or C:\PHP\php-cgi.dll.
  7. Click the "OK" button to save changes.

3. Test whether the configuration is effective

After configuring PHP in IIS, you need to test whether the configuration is successful. You can use the following steps to test this.

  1. Open a new file in any text compiler.
  2. Copy and paste the following PHP code into the file:

    phpinfo();
    Copy after login

    ?>

  3. Save the file to the web root directory of IIS. By default, the web root directory of IIS is located under the "C:\inetpub\wwwroot" directory.
  4. Open the browser in the Web and enter the following URL: http://localhost/the name of the PHP file you just saved.php
  5. Confirm that the browser successfully displays the PHP information page, indicating the configuration success. Otherwise, check that all configurations are correct.

Summary:

Through the above steps, we can successfully set up PHP in IIS, allowing us to achieve more Web development and applications. At the same time, configuring PHP in IIS can also give us a deeper understanding of the roles played by different types of servers in the web development process and how they work together.

The above is the detailed content of How to set up PHP in IIS. For more information, please follow other related articles on the PHP Chinese website!

source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!