*> sudo visudo
#find 'root ALL(...' and append this line below:
www-data ALL=NOPASSWD:/usr/local/bin/myscript.sh
#Save
*> sudo cp myscript.sh /usr/local/bin/
*> sudo chmod 777 /usr/local/bin/myscript.sh
#at php script:
<?php
$cmd = shell_exec("/usr/local/bin/myscript.sh params");
echo $cmd;
?>
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter