Answers for "php exec as root"

PHP
0

doument root phpp

$RootPath = $_SERVER["DOCUMENT_ROOT"];
Posted by: Guest on March-06-2021
0

php shell_exec with root

# add sudoers for www data to execute without pass
sudo vi /etc/sudoers
www-data ALL=(ALL) NOPASSWD: ALL

# execute with sudo 
shell_exec('python3 script.py')
Posted by: Guest on August-27-2021

Browse Popular Code Answers by Language