I have the following script (alert.sh) which has been setuid'd:
DISPLAY=:0.0 notify-send --urgency=low -i python "The job has finished"
and the following PHP file alert.php:
<?php
echo exec("/path/to/alert.sh")
When I su to www-data and run php alert.php, I get an alert on my screen. All good.
However, when I open alert.php in the browser, nothing happens.
I suspect some environment variable needs to be set, but I'm not sure which.