J2EEOnline J2EE

Web Perl   «Prev 

Running CGI on your server

How a CGI program runs

A CGI program is requested with a URL just like any other Web object. The URL specifies the logical location and name of the program in the same manner as it does any Web object.
In some cases, the path part of the URL may specify a special directory that is set aside for CGI programs.
That directory may be called "cgi-bin" or it may be named something else. It depends on how the server is configured.

In other cases, CGI programs may be allowed to reside in the same directories as HTML documents. In these cases, CGI programs are usually required to have a special filename extension (for example, .cgi), or some other unique designation so that the server knows to execute the file as a program, instead of just sending the file to the client as it does with a document or image file.
When the browser sends a URL to the server, the server then translates the path and filename parts of the URL to a specific location in its local file system. Then the server will decide if the file is a document or an executable program. The location, file type, and any permissions settings must be exactly correct in order to run the program.
When any of these parameters are not correct, the server will usually respond with a general message, such as
Internal Server Error: contact your system administrator
Messages like that are not very helpful to anyone, and often cost the system administrator a lot of time to find the cause. In order to avoid problems like these, you will need to know specifically how your server is configured before you can run your CGI programs.