Home Backend Development PHP Tutorial When php is run under iis in fastCGI mode, file system permission problems encountered and solutions

When php is run under iis in fastCGI mode, file system permission problems encountered and solutions

Aug 08, 2016 am 09:24 AM
administrator iis php

Today I am going to run a php demo under IIS. The configuration of the website under IIS is as follows:

The application pool is .net framework 2.0 in integrated mode (it doesn’t matter if it’s 2.0 or 4.0, because PHP runs in fastCGI mode). The application pool identity is configured as the NETWORKSERVICE built into IIS, and the authentication method used is anonymous authentication.

Open the local website and access the php page, but a 500 error occurs.

Okay, it’s a permissions issue. The simplest solution is to set the permissions of C:UsersAdministratorPhpstormProjectsphpDemo to Everyone, and allow full control:

Revisited the php page and succeeded:

The above method is simple enough, but it is also too unsafe. It is usually no problem to set up a local demo to do this, but when it is actually online, it will cause problems sooner or later.

So I reset it and gave the read-only permissions in the directory to the NETWRORKSERVICE account and tried again

However, the problem is still not solved. When accessing, a 401 error occurred

The error message includes the display that the logged-in user is anonymous. Check the authentication under the website (then click Anonymous Authentication->Edit). It turns out that by default, when the login method is anonymous, the default login user used by the website is IUSR. (This is the anonymous login user we see)

Then the solution is:

1. Set IUSR to the read permission of C:UsersAdministratorPhpstormProjectsphpDemo, similar to the previous setting of NETWORKSERVICE.

2. Or choose to use the application pool identity.

After testing, both methods 1 and 2 were successful.

Note: NETWORKSERVICE belongs to the iis_iusers user group in IIS7. The previous settings for NETWORKSERVICE can also be changed to the settings for iis_iusers, which can also solve the problem, but the permissions are further relaxed.

The above introduces the file system permission problems and solutions encountered when PHP is run under iis in fastCGI mode, including the relevant content. I hope it will be helpful to friends who are interested in PHP tutorials.

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

Hot Article Tags

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

PHP 8.4 Installation and Upgrade guide for Ubuntu and Debian PHP 8.4 Installation and Upgrade guide for Ubuntu and Debian Dec 24, 2024 pm 04:42 PM

PHP 8.4 Installation and Upgrade guide for Ubuntu and Debian

CakePHP Date and Time CakePHP Date and Time Sep 10, 2024 pm 05:27 PM

CakePHP Date and Time

CakePHP Project Configuration CakePHP Project Configuration Sep 10, 2024 pm 05:25 PM

CakePHP Project Configuration

CakePHP File upload CakePHP File upload Sep 10, 2024 pm 05:27 PM

CakePHP File upload

CakePHP Routing CakePHP Routing Sep 10, 2024 pm 05:25 PM

CakePHP Routing

Discuss CakePHP Discuss CakePHP Sep 10, 2024 pm 05:28 PM

Discuss CakePHP

CakePHP Quick Guide CakePHP Quick Guide Sep 10, 2024 pm 05:27 PM

CakePHP Quick Guide

How To Set Up Visual Studio Code (VS Code) for PHP Development How To Set Up Visual Studio Code (VS Code) for PHP Development Dec 20, 2024 am 11:31 AM

How To Set Up Visual Studio Code (VS Code) for PHP Development

See all articles