Information Technology Reference
In-Depth Information
time the program is run. A common example would be creating a Web page in
your browser that has a form in the page content. The form may request the
users e-mail address, and when the user submits their information the Web
server stores this information in a file that be accessed later. On the Web server
side there is action taking place. When the user hits the submit button the Web
browser makes a connection to the server, and requests the URL in the action
parameter and also sends all the form values that the user entered. The Web
server looks at the URL and realizes that is a program rather than a static file
and runs it. The program then grabs all the data sent to it, performs an operation,
and then returns the HTML page back to the browser as a response. This is the
typical process that almost all CGI scripts will go through.
Before all of this can happen, however, you need to make sure the Web server
is properly set up to handle CGI-If you plan on running CGI programs one
should check with their Web master or ISP to see if the server is setup correctly.
When the browser requests a URL from a server, the server needs to check if
the URL requested a static file to just load and send, or if it is an actual program.
This is decided by which directory the file is in and the file extension. CGI scripts
need to be in the “cgi-bin” directory. This is a server configuration issue. The
server is set up to know that any file in the directory is a program to run, and
not a static file to send to the browser. CGI-Bin is a directory where executable
CGI programs sit on a Web server. The second factor that determines if a Web
server runs a file or loads it as a static file is the file extension. The extension of
a file on the server — HTML, CGI, PL, TXT, and so on — tells the server what
kind of file it is and how to handle it. The CGI extension is an example of an
extension that the Web server is configured to recognize as a program it should
run. Once the Web server has decided to run the CGI program it makes the
request to the operating system to execute the file. The result may be a return
e-mail or an autoresponse.
After filling out a feedback form about the Web portfolio, a message comes
back saying thank you for providing feedback on this site. Using CGI is another
way to add dynamic, forms driven interactivity into the Web portfolio. Most
hosts provide free CGI scripts with code that you can copy and paste into a
Web page. These scripts need to be set to the path of the cgi-bin provided by
your host within the host server space that your Web portfolio resides in.
Experiment with CGI scripts on isolated pages at first to see the results of the
code you insert. Once you are confident in how the script works and what it will
do when activated by the user, then place the object into a live Web portfolio
page. Now let us discuss Perl.
Search WWH ::




Custom Search