Home >Backend Development >PHP Problem >How to create a PHP file directory and set permissions on IIS

How to create a PHP file directory and set permissions on IIS

PHPz
PHPzOriginal
2023-03-23 14:48:011612browse

IIS (Internet Information Services) is a set of web server software developed by Microsoft and is widely used for website construction on Windows operating systems. However, when developing PHP applications, a series of configuration and permission settings are required to ensure that the website can function properly.

In this article, we will explore how to create a PHP file directory on IIS and set the correct permissions.

IIS creates PHP file directory

Before using IIS to build a PHP application, you need to install PHP. If you don’t have PHP installed yet, you can download the latest version from PHP’s official website. After installing PHP, you need to specify the PHP interpreter in IIS.

  1. Install the FastCGI module

First, you need to install the FastCGI module in IIS. FastCGI improves the performance of PHP applications while reducing memory consumption on the server.

  1. Add the FastCGI module to IIS

Before adding the FastCGI module, you need to know the path to PHP-cgi.exe on your computer. This file will be created when you install PHP.

In IIS, select the Application Pools tab, then right-click your application pool and select Advanced Settings. In Advanced Settings, find the Processor Mapping setting and click Add Module Mapping.

In the pop-up dialog box, select the FastCGI module. In the Module box, select Full path to FastCGI module, and in the Executable box, enter the full path to PHP-cgi.exe. When finished, click OK to save the settings and close the dialog box.

  1. Create the PHP folder and index.php file

In IIS, create a folder named "PHP" and add a A PHP file named "index.php". This will be the home page of your PHP application.

Set PHP folder permissions

In IIS, the permissions to access the PHP folder require some additional settings.

  1. Add the PHP folder to IIS

In IIS, under "Default Website" or "Applications", create a new application. Point the application to the "PHP" folder you just created.

  1. Set "Network Services" user group permissions

Right-click on your "PHP" folder, select the "Properties" option, and then go to "Security" Tab. Add the "Network Services" user group to the folder's access permissions list and set it to "Read and Execute" permissions.

  1. Add an anonymous IIS user to the PHP folder

Right-click on your "PHP" folder, select the "Properties" option, and then enter "Security" Tab. Add "Anonymous IIS User" to the folder's access permissions list and set it to "Read and Execute" permissions.

Conclusion

With the above steps, you can create the PHP file directory on IIS and set the correct permissions. This will ensure that your PHP application functions properly and provides a seamless experience to your users.

The above is the detailed content of How to create a PHP file directory and set permissions on 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