next up previous contents
Next: Why Are File Permissions Up: Beginning CGI Programming in Previous: A First Perl CGI

Execution of CGI Programs

The Perl file that contains the CGI program should be placed in your Web server's cgi-bin directory.

Then, the URL for this program will be something like http://localhost/cgi-bin/test.pl (change localhost to correspond to your Web server's hostname).

Enter this URL into your Web browser and it should display a Web page saying "This is a test."

Note You may wonder how the Web server knows that a CGI program should be executed instead of being displayed. This is an excellent question. It can be best answered by referring to the documentation that came with your particular server.

When the Web server executes your CGI program, it automatically opens the STDIN, STDOUT, and STDERR file handles for you.

The Web server will also make some information available to your CGI program through environment variables.


next up previous contents
Next: Why Are File Permissions Up: Beginning CGI Programming in Previous: A First Perl CGI
dave@cs.cf.ac.uk