CGI scripts are executable programs or scripts that are run on a web server to produce HTML output to a client browser. In response to a client request for a script, the web server executes the script and transmits the output to the client browser. The Department of Computer Science & Engineering web server supports PERL, C/C++, and Bash CGI scripts. While PERL and Bash scripts are machine-independent, any C/C++ CGI scripts that you wish to use on your website must be compiled on the server on which they will be run - in this case, the server www.cse.unr.edu. Please follow the setup guide below to enable CGI scripts with your student account. Also, remember that all CGI scripts, regardless of programming language, must end with a ".cgi" extension to execute properly.
For more information about CGI scripts, please refer to the following resources:
- CGI Programming on the World Wide Web: An online textbook for CGI scripting
- PERL Official Website: Documentation and guides for PERL programming
How To: Setup CGI Scripts
From the home directory of your CS account (which is not the same as your ECC account), create a directory inside your "public_html" directory called "cgi-bin".
Change the permissions of your "cgi-bin" directory to be "world executable."
chmod 701 public_html/cgi-bin
Copy any CGI files into your "cgi-bin" directory and change their permissions to "world executable."
chmod 701 public_html/cgi-bin/program.cgi
Your CGI scripts should now be accessible at http://www.cse.unr.edu/~username/cgi-bin, where username is your computing account username.
Students must be careful when creating CGI scripts to ensure that no unauthorized persons can run scripts that could damage their files. It is recommended that students first run CGI scripts from the command-line of the server to ensure correct output before making them available on the Internet.
MySQL is a freely-distributable database that supports the storage of data via a number of metrics. The Department of Computer Science & Engineering web server supports PHP extensions that allow PHP scripts to interface with MySQL databases in order to create interactive, highly-useful web pages. For more information about MySQL, please refer to the following resources:
- MySQL Reference Manual: Complete documentation of most uses of MySQL databases
- SQL for Web Nerds: Tutorials on SQL database use
- A Gentle Introduction to SQL: An interactive tutorial and reference library for various databases
In addition to CGI scripts, the Department of Computer Science & Engineering web server supports the PHP programming language. PHP is a PERL-like scripting language that allows flexible, dynamic page generation without the need for compiling code. In response to a client request for a web page that includes PHP commands, the server executes the PHP code within the document and transmits the resulting HTML code to the client. PHP code is machine-independent and may be run on any web server that has the PHP engine installed on it.
The Computer Science & Engineering web server supports PHP, requiring only that any PHP-based web pages end with the ".php" extension.
Server Side Includes (SSI)
SSI (Server Side Includes) are directives that are placed in HTML pages, and evaluated on the server while the pages are being served. They let you add dynamically generated content to an existing HTML page, without having to serve the entire page via a CGI program, or other dynamic technology.
The Computer Science & Engineering web server supports SSI on web pages, requiring only that the web pages end with the ".shtml" extension to indicate to the server that the page contains SSI content.
For more information about SSI, please refer to the following documentation:
- Introduction to Server Side Includes: An introduction to SSI with Apache web servers