With Raspbian Wheezy I could do the following without any problem through a PHP script run by Apache on the local Pi:
exec('env DISPLAY=:0 xdotool mousemove 20 10 2>&1', $output);
But now I have upgraded to the latest Raspbian Jessie it doesn't work anymore. I get the following error in $output
:
No protocol specified
Error: Can't open display: (null)
Failed creating new xdo instance
Why is that and how do I fix it?
Note: The X session is running under the pi
user and Apache is running under the www-data
user.
Note: With Wheezy I used matchbox-window-manager and kweb browser, but now I use LXDE and Chromium that comes with Jessie. I don't think that should matter though, since as far as I recall xdotool also worked with LXDE in Wheezy (don't recall 100% for sure though).
Here is a very similar question but the answer is a work-around that doesn't work for me.