Reboot From PHP Page <?php //—– DO THE REBOOT —– //THIS SUDO COMMAND NEEDS TO BE AUTHORISED FOR APACHE TO USE IT IN THE FILE: sudo nano /etc/sudoers // # Special for this system – let apache run exes we use in the web interface // www-data ALL=NOPASSWD: /sbin/reboot echo '<pre>'; system("(sleep 2 ; sudo […]
Category: PHP Code Bits
.General PHP Code Tricks
Issuing Commands From Web Pages If you install a PHP web server on your RPi you can issue commands using the PHP system() function. Examples: //Echo some system status: echo '<pre>'; system('netstat -a'); echo '</pre>'; //Run an executable file: echo '<pre>'; system("sudo /home/pi/projects/my_project.a"); //system() will echo the output of the executable, use shell_exec() instead if […]