Environment variables exported to scripts
Stunnix Advanced Web Server exports a set of environment variables for use in scripts and in Server Parsed documents. All environment variables supported by Apache web server are exported.
You can see what environment variables are exported and their values by running sample site shipped with Stunnix Advanced Web Server just by executing /sample-image/site/stunnixwebsr/startsite.pl and following link to simple CGI script.
Environment variables common to Apache and Stunnix Advanced Web Server
The following variables are exported, with their values for the sample run on Linux of CGI script with parameter 'foo' set to value 'Test' (Stunnix Advanced Web Server 'srvrun.pl' script was located in directory /home/test/stunnix-web-server/stunnixwebsrv/ and was executed using system perl interpreter):
CGI_GATEWAY | CGI/1.1 |
DOCUMENT_NAME | sample-xcgi.xcgi |
DOCUMENT_ROOT | /home/test/stunnix-web-server/www/root/ |
GATEWAY_INTERFACE | CGI/1.1 |
HTTP_COOKIE | |
HTTP_USER_AGENT | Lynx/2.8.4 |
PATH_INFO | |
QUERY_STRING | foo=Test |
REMOTE_ADDR | 127.0.0.1 |
REMOTE_HOST | 127.0.0.1 |
REQUEST_METHOD | GET |
REQUEST_URI | /sample-xcgi.xcgi?foo=Test |
SCRIPT_DIR | /home/test/stunnix-web-server/www/root |
SCRIPT_FILENAME | /home/test/stunnix-web-server/www/root/sample-xcgi.xcgi |
SCRIPT_NAME | /sample-xcgi.xcgi |
SERVER_NAME | 127.0.0.1 |
SERVER_PORT | 9000 |
SERVER_PROTOCOL | HTTP/1.1 |
Environment variables unique to Stunnix Advanced 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.
Name | Value | Description |
---|---|---|
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_XCGI | 1 | 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 SetEnv 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.