Results 1 to 8 of 8

Thread: Perl .CGI not runnint on site

  1. #1

    Thread Starter
    Member
    Join Date
    Apr 2005
    Posts
    47

    Perl .CGI not runnint on site

    I have a perl .cgi located at:

    www.javauk.com/cgi-bin/sitemodules.cgi

    the contents of the file are:
    Code:
    #!/usr/local/bin/perl
    
    print "Content-type: text/html\n\n";
    
    print "<font size = 10 color = red>  <b>COM328J1</B>   </font color><br>";
    print "<font size = 10 color = green><i>COM347J1</i> </font color><br>";
    print "<font size = 10 color = blue>COM409J1  </font color><br>";
    print "<font size = 10 color = yellow>COM411J1</font color><br>";
    print "<font size = 10 color = black>COM332J2 </font color><br>";
    print "<font size = 10 color = cyan>COM333J2  </font color><br>";
    print "<font size = 10 color = brown>COM340J2 </font color><br>";
    print "<font size = 10 color = pink>COM374J2  </font color><br>";
    I have accessed the server via telnet/shh and typed Which perl to find the path and i got:
    -bash-2.05b$ which perl
    /usr/local/bin/perl
    i then ran the file from the cmd prmpt and got:

    -bash-2.05b$ perl sitemodules.cgi
    Content-type: text/html

    <font size = 10 color = red> <b>COM328J1</B> </font color><br><font size = 10 color = green><i>COM347J1</i> </font color><br><font size = 10 color = blue>COM409J1 </font color><br><font size = 10 color = yellow>COM411J1</font color><br><font size = 10 color = black>COM332J2 </font color><br><font size = 10 color = cyan>COM333J2 </font color><br><font size = 10 color = brown>COM340J2 </font color><br><font size = 10 color = pink>COM374J2 </font color><br>
    The problem is when i try and run the file from the browser i get an error

    any ideas?

    Thanks

    Nino

  2. #2
    VBA Nutter visualAd's Avatar
    Join Date
    Apr 2002
    Location
    Ickenham, UK
    Posts
    4,906

    Re: Perl .CGI not runnint on site

    What type of error do you get?
    PHP || MySql || Apache || Get Firefox || OpenOffice.org || Click || Slap ILMV || 1337 c0d || GotoMyPc For FREE! Part 1, Part 2

    | PHP Session --> Database Handler * Custom Error Handler * Installing PHP * HTML Form Handler * PHP 5 OOP * Using XML * Ajax * Xslt | VB6 Winsock - HTTP POST / GET * Winsock - HTTP File Upload

    Latest quote: crptcblade - VB6 executables can't be decompiled, only disassembled. And the disassembled code is even less useful than I am.

    Random VisualAd: Blog - Latest Post: When the Internet becomes Electricity!!


    Spread happiness and joy. Rate good posts.

  3. #3

    Thread Starter
    Member
    Join Date
    Apr 2005
    Posts
    47

    Re: Perl .CGI not runnint on site

    The page title says

    "500 internal Server Error"

    and the body:

    Internal Server Error
    The server encountered an internal error or misconfiguration and was unable to complete your request.

    Please contact the server administrator, [email protected] and inform them of the time the error occurred, and anything you might have done that may have caused the error.

    More information about this error may be available in the server error log.

    Thanks for any help

    Nino

  4. #4
    VBA Nutter visualAd's Avatar
    Join Date
    Apr 2002
    Location
    Ickenham, UK
    Posts
    4,906

    Re: Perl .CGI not runnint on site

    Is the script set to executble? Also, you may want to get rid of that blank line at the top of the script.
    PHP || MySql || Apache || Get Firefox || OpenOffice.org || Click || Slap ILMV || 1337 c0d || GotoMyPc For FREE! Part 1, Part 2

    | PHP Session --> Database Handler * Custom Error Handler * Installing PHP * HTML Form Handler * PHP 5 OOP * Using XML * Ajax * Xslt | VB6 Winsock - HTTP POST / GET * Winsock - HTTP File Upload

    Latest quote: crptcblade - VB6 executables can't be decompiled, only disassembled. And the disassembled code is even less useful than I am.

    Random VisualAd: Blog - Latest Post: When the Internet becomes Electricity!!


    Spread happiness and joy. Rate good posts.

  5. #5

    Thread Starter
    Member
    Join Date
    Apr 2005
    Posts
    47

    Re: Perl .CGI not runnint on site

    The blank line must have been how i pasted it in. I CHMOD the file to 755 but still no joy

    Nino

  6. #6
    VBA Nutter visualAd's Avatar
    Join Date
    Apr 2002
    Location
    Ickenham, UK
    Posts
    4,906

    Re: Perl .CGI not runnint on site

    Does the script work if you execute it from the command line? I.e:
    Code:
    # /full/path/to/script.cgi
    Try renaming it to sitemodules too.
    PHP || MySql || Apache || Get Firefox || OpenOffice.org || Click || Slap ILMV || 1337 c0d || GotoMyPc For FREE! Part 1, Part 2

    | PHP Session --> Database Handler * Custom Error Handler * Installing PHP * HTML Form Handler * PHP 5 OOP * Using XML * Ajax * Xslt | VB6 Winsock - HTTP POST / GET * Winsock - HTTP File Upload

    Latest quote: crptcblade - VB6 executables can't be decompiled, only disassembled. And the disassembled code is even less useful than I am.

    Random VisualAd: Blog - Latest Post: When the Internet becomes Electricity!!


    Spread happiness and joy. Rate good posts.

  7. #7

    Thread Starter
    Member
    Join Date
    Apr 2005
    Posts
    47

    Re: Perl .CGI not runnint on site

    i got the SSH logons and comiled the file from commandline thing with no problems. and also executed it via SSH with no problems, tis white strange problem

  8. #8
    Fanatic Member
    Join Date
    Jan 2005
    Location
    In front of this pc.
    Posts
    580

    Re: Perl .CGI not runnint on site

    Try for the simple stuff..pico the perl script. i.e. "pico -w sitemodules.cgi" - when pico opens the script make any change (I normally just hit enter and then backspace) so that pico will allow you to save the updated file and try it again...Lynux servers especially have a tendancy not to allow the script to be executed unless it was written on the server.

    The other thing to try would be "perl -c sitemodules.cgi" and see if any errors are reported.

    And just a little fyi here, you might want to look at using perls quoted print when printing multiple lines, especially of html. i.e.
    Code:
    print qq~
    put all of your html here in as many lines 
    as deisred and formatted as desired and then close it with
    ~;
    as that not only eliminates having to say print repeatedly but it will also cause perl to automatically ignore any special characters, such as ampersands, that will cause perl printing problems.

Posting Permissions

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



Click Here to Expand Forum to Full Width