Is there a root user in PHP?

Asked

Viewed 228 times

0

The function chroot() needs super user to work, there is a function that login as root?

  • 4
  • Out of curiosity, what is the need to allow PHP to directly access something at the root level? I mean if you want to use PHP scripts in the terminal just use the sudo (or su) what would solve, now run in web environment I see no real need.

  • 1

    My dear friend, there is need, post as I have already said. THE FUNCTION REQUIRES ROOT LEVEL.

1 answer

2


This is machine configuration, include your Apache user (www-data) in sudoers. In the terminal, do:

# visudo 
# vim /etc/sudoers 

Add at the end of the file:

www-data ALL=(ALL) ALL

But be careful with that. You’ll be letting Apache do whatever you want. There are ways for you to specify what the user can do as root, which is ideal for your case.

  • Okay, could you give me a hand with that? Is that I’m layy and tals kkk

  • Enter as root in the terminal and execute these commands I put. In the file, below where you have "User privileges Specification" adds the mentioned line.

  • To put specific commands, you can use www-data ALL=(ALL) NOPASSWD: <pathdocomando>.

  • I noticed that this function only works on the terminal. That’s why it’s not working

Browser other questions tagged

You are not signed in. Login or sign up in order to post.