How to change file owner in php

青灯夜游
Release: 2023-03-11 14:40:02
Original
3032 people have browsed it

The chown() function can be used in php to modify the owner of the file. This function can change the owner of the specified file. If the modification is successful, it returns TRUE, if it fails, it returns FALSE; the syntax format is "chown(file ,owner)", the parameter owner specifies the new owner, which can be the user name or user ID.

How to change file owner in php

The operating environment of this tutorial: windows7 system, PHP7.1 version, DELL G3 computer

In php, you can use chown () function to modify the owner of the file.

chown — Change the owner of a file, returning TRUE on success or FALSE on failure.

Syntax

chown(file,owner)
Copy after login
Parameters Description
file Required. Specifies the documents to be checked.
owner Required. Provide new owner. Can be a username or the user's ID.

Example: Change file owner and user group

Copy after login

Note:

  • The chown() function cannot operate on remote files. The file being checked must be accessible through the server's file system.

  • When safe mode is enabled, PHP will check whether the file or directory being operated on has the same UID (owner) as the script being executed.

Recommended learning: "PHP Video Tutorial"

The above is the detailed content of How to change file owner in php. For more information, please follow other related articles on the PHP Chinese website!

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