| Academic Computing and Communications Center | ||||||||||
|
|
|
|
|
|
|
|
|
|
|
|
|
|||||||||||||||||
1. Introduction |
|||||||||||||||||
| CGI Scripts | |||||||||||||||||
|
Normal web pages are static files. You create the file in HTML, put it on disk, and every time a browser fetches the file, it always gets the same file. This is simple and it gets the job done. However, sometimes static files are not enough. Sometimes you want the returned page to depend on a form that the user submitted. Or perhaps you want to record the information from the form in a disk file. Instead of serving a static file, you want the web server to run a program and feed the result of this program back to the web browser. Such a program is called a CGI program or CGI script. (CGI is Common Gateway Interface, if you must know. The name is meaningless. And although the difference between "script" and "program" can spark religious wars among geeks, I'll use the terms interchangeably.) The ACCC now allows general users to run CGI scripts, at least on an experimental basis. This is not risk-free, however, and you must determine if your need outweighs the risks. Also realize that there are limitations on your scripts, so you still might not be able to do everything you desire. |
|||||||||||||||||
| Warnings | |||||||||||||||||
|
Why worry about CGI scripts?
If you choose to run CGI scripts, you are choosing to accept responsibility for the results, good or bad. And like any program, if your cgi script causes trouble for the server, we will have to shut it off. |
|||||||||||||||||
| Why Run CGI Scripts? | |||||||||||||||||
|
If you are sufficiently skilled, CGI scripts can be run in reasonable safety. And if you need to process forms, upload files, update or search databases, they are necessary. Of course, you can use scripts, such as FormMail or SearchUIC, provided by the ACCC. But you can also roll your own if you feel the need. You might even try your hand at CGI scripts just for fun and education. Of course, CGI programming is 98% programming and 2% CGI. But programming is fun, so why not? |
|||||||||||||||||
| Why Not Run CGI Scripts? | |||||||||||||||||
|
Why not? Because they can be dangerous to the unwary. See the warnings above. And due to the limitations, the CGI may still not do all you want. HTML is fairly simple, and anyone can get useful results from a few tags. CGI programming is not so simple. You really do need to know something about programming. It's within reach of anyone who really wants to learn some programming, but if you are not already proficient at programming, you are not going to become a useful CGI/perl programmer in a couple of hours. You have to decide how much your time is worth. There exist several alternatives, so you can do CGI-like things without writing your own scripts. And the ACCC supplied scripts are not subject to the UIC-only limitations that your scripts must obey. For example:
|
|||||||||||||||||
| Languages and Limitations | |||||||||||||||||
|
We now have support for different languages. But due to the nature of the interpreters, we have different limitations on their use. We can't make all the dangers of CGI go away, but we try to minimize them. We also try to limit any problems so only your account is affected, and we try to make it hard to create problems by accident. Note that ACCC provides some existing scripts for general use, and the limitations below don't apply to these scripts. |
|||||||||||||||||
| -PHP | |||||||||||||||||
PHP is now one of our most flexible options.
Note to use PHP, you will call the codewrap
program. See later pages for detailed documentation.
Advantages
Limitations
|
|||||||||||||||||
| -Perl | |||||||||||||||||
Perl doesn't let us limit file access the way PHP does,
so we impose additional restrictions to protect the server.
To use perl, you will call the perlwrap program.
Advantages
Limitations
|
|||||||||||||||||
| Common Safety Considerations | |||||||||||||||||
There are many pages on the web about safe CGI programming. I'd start with Yahoo. |
|||||||||||||||||
| CGI | Previous: 0 Contents | Next: 2 Background |
| 2011-5-26 wwwtech@uic.edu |
|