The following steps are required to get the Gsharp Web Edition
and its examples running on your web server:
- The GsharpWE executable must be made available as /bin/GsharpWE
Login as root and set up a symbolic link from /bin/GsharWE to the
GsharpWE executable. The commands will be similar to the following:
cd /bin
ln -s /usr/uniras/7v3/bin/GsharpWE GsharpWE
This step is required as each GsharpWE script uses the following
line to show that it must be executed by GsharpWE:
#!/bin/GsharpWE
- Now open a new shell (without the UNIRAS environment having been initialised)
and move to the GsharpWE cgi-bin directory. e.g.
cd /usr/uniras/7v3/example/cgi-bin
Now try running the gallery example:
./gs_gallery.gsw
If the above command outputs HTML then you are running on an Operating
System that Gsharp can auto-setup the required environment variables.
If the command produced the following error
ERROR: No access to message catalog "Gsharp"
then you must set up the following environment variables in your web
server configuration
file:
- UNIDIR to be the directory above the directory containing Gsharp
executable.
- NLSPATH to be $UNIDIR/msg/C/%N
- LD_LIBRARY_PATH to be the /lib directory (normally $UNIDIR/lib)
- LM_LICENSE_FILE to your license file (normally $UNIDIR/base/license.dat)
(On Linux the environment variable is TM_LICENSE_FILE)
- TEMP to be the directory used for temporary files
For an Apache Web Server add lines similar to the following to httpd.conf:
SetEnv UNIDIR /usr/uniras/7v3
SetEnv NLSPATH /usr/uniras/7v3/msg/C/%N
SetEnv LD_LIBRARY_PATH /usr/uniras/7v3/lib/
SetEnv LM_LICENSE_FILE /usr/uniras/7v3/base/license.dat
SetEnv TEMP /TMP/
N.B. You will need to modify the commands to match your installation
- You must create a directory where temporary files can be written to.
- The directory must be part of your web server (see next step)
- The cgi-bin process must be able to write files to this directory.
For security reasons the cgi-bin process is normally run as the
user nobody. This means you must give your directory world
write permission e.g.
chmod 777 /tmp/GsharpWE/
- You may like to setup a cron job to delete all the files in this
directory on an hourly, daily, weekly or monthly basis.
- You will need to add a number of directories to your web server. This
can be done by using mappings in the configuration files of your web
server or by physically copying the files into your document hierarchy.
We recommend using mappings as shown below:
- The files in $UNIDIR/example/cgi-bin should be made available
as scripts on your web server.
The Gsharp examples assume that they can be found in /Gsharp-bin/.
With apache web servers you use the ScriptAlias command e.g.
ScriptAlias /Gsharp-bin/ "/usr/uniras/7v3/example/cgi-bin/"
If you use a name other than Gsharp-bin you will need to modify
the following files.
- The directory $UNIDIR/example/GsharpWE should be added to your
web server. We suggest you add it as /GsharpWE/. You will also need
to make sure your directory for temporary files can be found on
your web server. If you wish, you could also add the Gsharp On-line
Documentation to your web server.
On Apache web servers you should add lines similar to the following
to httpd.conf
Alias /GsharpWE/ "/usr/uniras/7v3/example/GsharpWE/"
Alias /GsharpTmpFiles/ "/tmp/GsharpWE/"
Alias /Gsharp/ "/usr/uniras/7v3/help/"
- Environment variables must be created which specify the name of your
directory for temporary files (GsharpTmpFilesActualDir), the
name of how it appears on your web server (GsharpTmpFilesWebDir)
and the name of your cgi-bin directory (GsharpWEcgi-binDir).
When a Gsharp Web Edition script runs it will read these variables
and alter its HTML output appropriately. You can either do this in
your server configuration scripts e.g.
SetEnv GsharpTmpFilesActualDir /tmp/GsharpWE/
SetEnv GsharpTmpFilesWebDir /GsharpTmpFiles/
SetEnv GsharpWEcgi-binDir /Gsharp-bin/
or you can specify these values in the Gsharp initialisation script
$UNIDIR/base/Gsharprc.gsl
if webedition() then
putenv("GsharpTmpFilesWebDir=/GsharpTmpFiles/");
putenv("GsharpTmpFilesActualDir=/tmp/GsharpWE/");
putenv("GsharpWEcgi-binDir=/Gsharp-bin/")
endif
-
Restart your web server and you should be able to run the GsharpWE
examples from http://yourmachine/GsharpWE/.
If you still get problems, check the error log file for the web server.