简体   繁体   English

PHP:如何以root用户身份运行readdir()

[英]PHP: How to run readdir() as root

I am trying to make a lightweight frontend for my fileserver. 我正在尝试为我的文件服务器创建一个轻量级的前端。 I use PHP to display all the files, but readdir() is executed as the http user, because apache is started as this user. 我使用PHP显示所有文件,但readdir()以http用户身份执行,因为apache以该用户身份启动。

This is a problem, because I want to view all my files. 这是一个问题,因为我想查看所有文件。 Therefore, readdir() has to be run as root, but I don't know how to do that. 因此,readdir()必须以root身份运行,但是我不知道该怎么做。 Can you guys help me? 你们能帮我吗?

This cannot be done. 无法做到这一点。 You can't run a single function as another user unless you started out as that user and then are shifting back to them temporarily. 您不能以其他用户身份运行单个功能,除非您以该用户身份开始然后暂时移回他们。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM