Newsletter

KB Article

GP COM
Howto use CGI-scripts

Howto use CGI-scripts

Please notice: CGI-scripting must be activated in your installation.

If you want to install your own CGI-scripts there are a few guide lines you must follow:

CGI-scripts must be placed in the cgi-bin folder which is located similar to:

 /home/brugernavn/www/cgi-bin/ 

or in a sub folder, to be able to be executed on the server. All files in this folder will be seen as scripts by the webserver, nomatter what their actual names are. This means that it isn't possible to show a HTML page that is in the cgi-bin folder, because the webserver will try to execute it, which in turn will, in must cases, result in an error.

The must often made error in a CGI-script will lead the browser to displaying

 "HTTP Error 500: Internal server error."

, which isn't very usefull when debugging. There are especially 2 precaousions that can be very usefull:

  • Test the scripts as much as possible, and on an internal server. For one it isn't very professionally to see an error message on a live website, secondly it can be very difficult to stop a runaway process on a remote server.

  • If the script works locally but not on the server then it is time to examine the error logfile - it is in
     /logs/error-log 
    and contains all error messages for the last 24 hours. It can often be an advantage to enable detailed error logging, perl has the '-w' option that can be added to the first line of the script, like:
    #!/usr/bin/perl -w

You are welcomed to contact support if no error log exists - then we will make sure that it is.


Category: CGI