简体   繁体   中英

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.

This is a problem, because I want to view my files. 文件。 Therefore, readdir() has to be run as root, but I don't know how to do that. 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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