The campus webserver permits running of CGI scripts through CGIwrap,
which assures that your scripts run under your own account. Although
other languages could potentially be used, just about everyone
uses Perl for CGI scripts. You may either import scripts that
you find out on the Internet or write them yourself. To enable
them to run you must create a "cgi-bin" directory under
your htdocs directory and make sure that the permissions allow
public read and execute access but not write access. Fortunately
that is the normal default for directories.
Place your CGI scripts inside your "htdocs/cgi-bin/"
directory and set their permissions to the same values (owner:
read, write, execute; group: read, execute; public: read, execute,
ie. Unix permission code 755). You may also place the scripts
in subdirectories of your "cgi-bin" directory if you
prefer to organize them that way.
Use the ".cgi" extension on the name for your script,
eg: "takeform.cgi".
The first line of your Perl CGI scripts should be either:
#!/usr/local/bin/perl
or:
#!/usr/bin/perl
The syntax for this line is strict; do not include anything else
on this line, not even a blank character at the end. It's generally
best to check the syntax of your script on your own system with
your local version of perl before trying it out as a CGI. Faculty
and staff may also use vanilla.csulb.edu for that purpose.
To call your CGI script, use a URL in the following format:
http://www.csulb.edu/~username/cgi-bin/scriptname.cgi
Use your own account name after the tilde (in place of "username").
Typically you would include this URL as the action to be taken
by a form that submits data to the CGI script.
Pitfalls to Avoid: