CGI programs are the simplest way to get a program to run on the World Wide Web. A CGI program is just a program which has ".cgi" on the end of its name. For example, "search.cgi" is a valid CGI program name (assuming search.cgi is an executable file, a shell-script or some other program.)
When the user clicks on the CGI program, the web server itself will run the program, not the user's machine. So the CGI program must be executable on the machine where the web pages are coming from.
The CGI program must also be readable and executable to anyone, because when the web server tries to load and run the program, it does so without the permissions of the person who created it.
GraphApp programs are graphical. When executed they will attempt to make windows appear on the screen, so the user can interact with the program.
Here's the problem:
The program is running on a remote machine, not on the user's machine. So how is the user supposed to see the windows which appear?
In practice this means the following: Suppose the remote machine is called zeta.cs.su.oz.au and the user wishes to run a program on that machine.
The user types the following on their terminal:
xhost +zeta.cs.su.oz.au
This command allows the remote machine to pop up windows on the
user's machine.
Then the user runs the CGI script which runs the GraphApp program. The user would have to somehow tell the program what their DISPLAY variable is, so the program knows where to put the windows.
The user would have to be instructed how to discover the value of their DISPLAY variable (for instance using echo $DISPLAY) and then told to type it into the CGI program somehow.
Probably the easiest way to do this is to have a CGI script which sets its own internal DISPLAY variable to be the same as the user's, and then runs the GraphApp program. The GraphApp program would have the same DISPLAY variable as the CGI program, and would thus send windows to the user's machine.
The user's DISPLAY variable must include their hostname, so it should look something like this: host.cs.su.oz.au:0.0 or else like this: 123.12.0.212:0.0
Additionally, the program is executed by the web server, so if the program needs to change any files, those files must be publically writable.
The other important thing to remember is that running remote programs on X-Windows can be slow. Graphics requests sent over the net are slower the further the user is from the remote machine.