im trying to execute a bash script with a php/html button to wake my nas.
<form action="" method="POST">
<input type="submit" value="Wake NAS" name="zero" />
</form>
<?php
if (isset($_POST["zero"])){
#echo "Hello World!";
shell_exec("/var/www/html/wakenas.sh &");
}?>
"Hello World" is printed when button is pressed.
but code won't be executed.
the wakenas.sh looks like this and works if i execute it over shell
#!/bin/bash
etherwake -D "BC:5F:F4:09:E1:07"
echo "why!?!?!" > "/var/www/html/works.txt"
exit 1
wakenas.sh has all rights
Maybe you guys know why it wont be executed.
thanks in advance
shell wakenas.sh? Can you put the outputofls -l /path/to/wakenas.shsh /path/to/wakenas.shls -l wakenas.sh:-rwxrwxrwx 1 www-data www-data 126 Jun 4 12:47 wakenas.shvar_dump(shell_exec("/var/www/html/wakenas.sh &"));to see whether it returnsNULL(php.net/manual/en/…) and check you/var/www/html/works.txtfile contentls -l /var/www/html/works.txtnobody,www-data, orapache2) have rights to executewakenas.sh? Please be aware that if there is any public access to the page, you should NOT give shell access/execute rights to your web server.