Give apache sudo rights

navigate to a php page and execute

die(shell_exec("whoami"))

depending on what distro you have you might get “www-data” or “apache”, in my case I got “apache”

go over to your terminal

visudo

right above the line “root ALL-=(ALL) ALL” type in

also comment out this line in same file

Defaults    requiretty

save file and execute

service httpd restart

now in your command in php use sudo

Leave a Reply

Your email address will not be published.