linux - How to provide required privilege for www-data user in php -


i trying execute shell script copy folders , files 1 location another.

but struggling basic problem - ie; cannot copy folders or files when call script php. whereas same script works perfect terminal. because that, terminal when execute script, user has has enough privileges copy/create files/folders , when script called php, user not have enough privileges?

for php, shell_exec('whoami'); says user www-data

what should do, in order that, have enough privileges create , copy operations php user www-data

any appreciated.

add this:

username all=nopasswd: /path/to/script 

in sudoers file, in /etc/sudoers, can use visudo command edit file.


Comments