I am fairly new to php, but I was trying to use php to launch a shell script.
When I use php /var/www/html/indexes.php it works, but when I load up the webpage the shell script does not do all of what it is meant to.
<?php $result = shell_exec('sh /home/user/Desktop/script.sh'); echo $result; (just to make sure it fired) ?>
#!/bin/bash echo "Hello World" sudo -u user nautilus
When I fire the php through the console it works, but when I load the webpage up it does not. I have run chmod +x on both the php and shell scripts, with no luck. It returns the Hello World, but does not fire up the nautilus as the user. I don't know but maybe it has something to do with the X server? Any help would be greatly appreciated.