I am running an Apache webpage on my Raspberry Pi. When I connect to the Pi's network I am able to access that webpage. On this webpage I would like to have a button that runs a shell script located inside the pi itself. All the script is doing is running fswebcam so that the usb webcam attached to the pi takes a screenshot. What I am not able to do is call that .sh script from the pi's webpage. Perhaps running it as .cgi from the cgi-bin? Not even sure how the syntax would look in php. Any help is appreciated.
Here's the .sh script running fswebcam in case its relevant:
#!/bin/bash
DATE=$(date +"%Y-%m-%d_%H%M")
fswebcam -r 1920x1080 --no-banner /var/www/html/$DATE.jpg
Cheers!
system()orexec()orshell_exec()or similar. Alternatively configure apache to run shell scripts using cgi-bin (maybe httpd.apache.org/docs/current/howto/cgi.html can help)