Environment variables exported to CGI and XCGI scripts

Stunnix Perl Web Server exports a set of environment variables for use in CGI and XCGI scripts, and in Server Parsed documents. In particular, majority of environment variables are the same as exported by Apache web server.

You can see what environment variables are exported and their values by running sample site shipped with Stunnix Perl Web Server just by executing /sample-image/site/stunnixwebsr/startsite.pl and following link to simple XCGI script.

Environment variables common to Apache and Stunnix Perl Web Server

The following variables are exported, with their values for the sample run on Linux of XCGI script with parameter 'foo' set to value 'Test' (Stunnix Perl Web Server 'srvrun.pl' script was located in directory /home/test/stunnix-web-server/stunnixwebsrv/ and was executed using system perl interpreter):

The only variable that Apache would export but SPWS doesn't is PATH_TRANSLATED, but it's easy to compute it from value of PATH_INFO.

Environment variables unique to Stunnix Perl Web Server

Here are exported environment variables with their values for the same sample run of XCGI script on Linux, with descriptions of the meaning of each variable.

PERL_INTERP_NAME/usr/bin/perl Commandline to execute Perl interpreter. If site is packed into single executable with Perl interpretrer embedded, the value of this variable will be name of .exe file with special additional commandline options. Use the value of this variable instead of $^X for execution of Perl scripts.
RUNNING_VIA_XCGI1 This variable is set to 1 for scripts that being run using XCGI calling convention
SERVER_ROOT/home/test/stunnix-web-server/stunnixwebsrv/ Directory where srvrun.pl script is located. Useful for computing path to other files used in (x)CGI scripts
STUNNIXWS_STATEDIR/home/test Provided as platform abstraction service by 'startsite.pl' script. This is a directory where to store global user-specific settings and documents (independant of version number of your browser-based appliation).
STUNNIXWS_TMPSTATEDIR/home/test/.stunnixws//Perl-Obfus-2.0-Standard-0/ Provided as platform abstraction service by 'startsite.pl' script. This is a directory where most files specific to the current user, site id and current version number of site can be stored.

Other environment variables

It's possible to request SPWS to temporarily export additional environment variables when documents or scripts are served/executed on a per-location basis too using Set Env directive in configuration file. It's very useful for passing various bits of configuration information like name of database to use or name of default CSS stylesheet.