#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2003
    Location
    san francisco
    Posts
    1
    Rep Power
    0

    My cgi scripts slowed way down (i'm an idiot)


    I keep getting CGI timeout screens in my browser. I never used to. I used perl and IIS on winxp to run a local moveabletype site succesfully since june. then i wiped the drive and started over. I have it all set up again but any page i execute with a .cgi suffix just hangs and i haven't figured it out yet. I've set the CGI timeout to 999999 but that doesn't seem to help (i've also been looking on google for an answer for nearly a month now, how embarrasing)-. I'd be extremely grateful to anybody that could toss me a clue. thanks!
  2. #2
  3. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2003
    Location
    Johannesburg, South Africa
    Posts
    186
    Rep Power
    29
    The timeout probably occurs on your browser, but that is the least of your problems. Can you see on your task manager if the scripts are executing while you are waiting on your browser? The other thing I use to do is dump some progress indicaters to a file as the script runs. You can then use this file later for debugging. Using a simple example ( Unix ):

    Code:
         1	#!/usr/bin/perl
         2	
         3	use strict;
         4	
         5	my $debugfile = "/tmp/debug_";
         6	my $debug = 1;
         7	my $debugcounter = 0;
         8	
         9	# when the app starts, see if we need to turn on the debugging file:
        10	if( $debug ) {
        11	
        12		$debugfile .= time();
        13		Debug( "Debugging started" );
        14	
        15	}
        16	
        17	# now your start your main program execution
        18	# anytime you need to trace the progress of your application
        19	# use the Debug() function:
        20	if( $debug ) { Debug( "App start" ); }
        21	
        22	print "This is a useless app\n";
        23	sleep( 5 );
        24	
        25	if( $debug ) { Debug( "App stop" ); }
        26	exit;
        27	
        28	sub Debug {
        29	
        30		# Get the text line
        31		my $text = shift;
        32		my $line;
        33		open( OUTF, ">> $debugfile" );
        34		
        35		my $time = time();
        36		if( $text =~ /\w/ ) {
        37		
        38			$line = "[ $time ] $text";
        39		
        40		} else {
        41		
        42			$debugcounter++;
        43			$line = "[ $time ] Counter=$debugcounter";
        44		
        45		}
        46		print OUTF "$line\n";
        47		
        48		close( OUTF );
        49		
        50		return 1;
        51	
        52	}
    The content of an example debug file:

    Code:
    $ cat /tmp/debug_1071121253 
    [ 1071121253 ] Debugging started
    [ 1071121253 ] App start
    [ 1071121258 ] App stop
    Nullum magnum ingenium sine mixtura dementiae fuit.
    [There is no great genius without some touch of madness.]
    -- Seneca

IMN logo majestic logo threadwatch logo seochat tools logo