I have Apache and PHP running on my local Linux desktop. My PHP script launches \"xcalc\", and looks like this:
xcalc needs either a -display
option or the DISPLAY
environment variable set to know which X server to display on. When you run it from the shell, it's probably picking up $DISPLAY
from your shell environment, but the Apache web server normally won't have that
set.
You may also run into X authentication issues, if the X session isn't being run by the same user as the Apache web server, since X normally relies on a shared secret (the “magic cookie”) stored in the $HOME/.xauthority
file of the user who logged into the X session.