www.webdeveloper.com
Results 1 to 5 of 5

Thread: Why isn't my counter working?!

  1. #1
    Join Date
    Dec 2005
    Posts
    4

    Angry Why isn't my counter working?!

    Hey all, i'm still in training as far as perl and cgi are concerned, so please hear me out.

    I downloaded a counter script from htmlgoodies.com and uploaded it to my site, (you can see the modified script at tcnj.edu/~jpnclub/cgi-bin/countcgi.cgi
    the page i'm trying to get a count for is tcnj.edu/~jpnclub/index.html)

    I modified the file according to the instructions provided with it- i telnetted into the server, went to the appropriate folder, used the "pwd" command to get the appropriate absolute path, did chmod 775 on all relevant files and folders. I confirmed that the perl program is located in the stardard place on the server (/usr/bin/perl). I've been going over this whole thing for hours, still no luck, i'm getting rather frustrated to say the least. any help would be greatly appreciated

    thanks,
    -nick

  2. #2
    Join Date
    Dec 2002
    Location
    Pleasanton, CA
    Posts
    2,132
    Quote Originally Posted by fox1324
    ...you can see the modified script at cnj.edu/~jpnclub/cgi-bin/countcgi.cgi
    You need to attach the script source code. All that link does is 'run' the script.

    You should chmod to 755 not 775 (althought your script should still run).

    Did you telnet in ACSII mode. If BINARY, it will not work.

    That said, when I attempt to access the above link, I get a 'page not found' error which indicates the your script is NOT in the cgi-bin directory or it's not named 'countcgi.cgi'.

  3. #3
    Join Date
    Dec 2005
    Posts
    4
    Quote Originally Posted by Nedals
    You need to attach the script source code. All that link does is 'run' the script.

    You should chmod to 755 not 775 (althought your script should still run).

    Did you telnet in ACSII mode. If BINARY, it will not work.

    That said, when I attempt to access the above link, I get a 'page not found' error which indicates the your script is NOT in the cgi-bin directory or it's not named 'countcgi.cgi'.
    my bad! at the end of the night, i changed the script's extension to .pl to see if that would make things work...it didnt. forgot to change it back, thats why you couldnt see the script. the full script is now available at http://www.tcnj.edu/~jpnclub/cgi-bin/countcgi.cgi .

    the relevant lines of code are:
    #!/usr/bin/perl
    $minLen = 7;

    #This is absolute path of the directory where the counter files are stored. Must be global-writeable.
    $counterdir = "/home/acct3/jpnclub/www/counts";
    EDIT: also, i chmod'd everything to 755, still no luck. and the script was uploaded in ascii mode. (as far as i can tell)

  4. #4
    Join Date
    Dec 2002
    Location
    Pleasanton, CA
    Posts
    2,132
    That is not a well written script.

    #!/opt/local/bin/perl
    This does not look correct, but it might be, and it should be on line 1. Check to be sure.

    The link you provided should have run the script, not return the source code. Do you have any other cgi scripts running on your server?

    Try this, using the more usual shebang line...
    Code:
    #!/usr/local/bin/perl
    
    print "Content-type: text/plain\n\n";
    print "Hello World\n";
    exit;
    save as 'test.cgi' in your cgi-bin directory and chmod 755
    run with 'cnj.edu/~jpnclub/cgi-bin/test.cgi' in the address bar.

    Then modify, and run, the script with the following..
    Code:
    #!/usr/local/bin/perl
    
    use strict;
    use CGI;
    my $q = CGI->new();
    
    print $q->header();
    print "Hello World\n";
    exit;
    If that works, which it should, I'll explain and show you how to modify your script

    Update:
    I notice that in your last reply, the shebang line is as follows..
    #!/usr/bin/perl

    Which is it??
    Last edited by Nedals; 12-08-2005 at 01:09 AM.

  5. #5
    Join Date
    Dec 2005
    Posts
    8
    i believe you will need perl5 to run cgi reliably. so on telnet do a "whereis perl" and "whereis perl5"...

    your perl installations on your webserver and the apache server shoudl have cgi installed, but it may not... also, i think since your not actually running in the servers real cgi-bin, you may have to reference 'cgi-lib.pl'.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles