What to do if the php file does not have permissions

藏色散人
Release: 2023-03-17 12:48:02
Original
2704 people have browsed it

Solution to the problem that the php file does not have permissions: 1. Use the "ls -l ./[target_dir]" command to check the permissions; 2. Set the entire directory through "chown -R apache:apache [target_dir]" 3. Execute the "sudo -u apache git reset --hard 977e75b" command.

What to do if the php file does not have permissions

The operating environment of this tutorial: Windows 7 system, PHP version 8.1, Dell G3 computer.

What should I do if the php file does not have permission?

PHP reports file_put_contents failed to open stream: Permission denied in xxxxx on line 2

Use the command to check the permissions: ls -l ./[target_dir]

What to do if the php file does not have permissions

The permissions of this file have become root, not apache anymore.

Because git is installed in the project, git is executed under the root user. This should be the reason.

Solution:

Set permissions on the entire directory first chown -R apache:apache [target_dir] (restore permissions to apache)

Then every time you execute the git command, use the apache user to execute sudo -u apache git reset --hard 977e75b

Recommended learning: "PHP Video Tutorial"

The above is the detailed content of What to do if the php file does not have permissions. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
php
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