So, now you have a program running on the server as
webuser or something similar. It is important to know the name of the user that your script is running as, especially if your program must read or write to any files. Remember that in a UNIX environment, file permissions are very important. If the Web server is running your CGI as
nobody and it needs to write to a file owned by
betty, and this file is
chmod'd to 744 (-rwxr- -r- -) so only the owner can write to it, your CGI will fail because it can't write to the file.
After your program is run, all the variables discussed in the previous section are stored in its environment and available to it. Using these variables in your CGI is quite simple by using the Perl WWW libraries.
The following output is the actual environment that was generated by a Netscape Communications Server after a request was sent from Netscape Navigator:
SERVER_SOFTWARE : Netscape-Communications/1.12 SERVER_NAME : somewhere.corp.sgi.com GATEWAY_INTERFACE : CGI/1.1 <br> SERVER_PROTOCOL : HTTP/1.0 SERVER_PORT : 80 REQUEST_METHOD : GET PATH_INFO : /path/foo PATH_TRANSLATED : /var/www/htdocs/path/foo SCRIPT_NAME : /html_tutorial/cgi-bin/env.cgi QUERY_STRING : query_string REMOTE_HOST : amiga.huntsville.sgi.com REMOTE_ADDR : 184.108.40.206 AUTH_TYPE : REMOTE_USER : REMOTE_IDENT : CONTENT_TYPE : CONTENT_LENGTH : HTTP_ACCEPT : image/gif, image/jpeg, */* HTTP_USER_AGENT : Mozilla/2.0S (X11; I; IRIX 6.2 IP22) HTTP_REFERER : http://server.sgi.com/html/cgi.html ANNOTATION_SERVER :