The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Internal server error

Discussion in 'General Discussion' started by Radio_Head, Sep 4, 2002.

  1. Radio_Head

    Radio_Head Well-Known Member

    Joined:
    Feb 15, 2002
    Messages:
    2,051
    Likes Received:
    1
    Trophy Points:
    38
    When I run this simple perl script from web....

    #!/usr/bin/perl
    open(SENDMAIL, &|/usr/sbin/sendmail -t -odi&) or die &error: $!\n&;
    print SENDMAIL &&&EOF&;
    From: TestFrom &info\@domain.com&
    To: test &test\@domain.com&
    Subject: mail test
    test
    eof
    close (SENDMAIL) or die &sendmail didn't close nicely&;
    exit;


    ... I receive an internal server error (however I receive the Email) .
    If I execute above script from command line it works fine , no error . Why ? Thanks
     
  2. SHSaeed

    SHSaeed Well-Known Member

    Joined:
    May 9, 2002
    Messages:
    245
    Likes Received:
    0
    Trophy Points:
    16
    Your script is not printing anything to the browser, not even sending a header..

    Try adding..

    print &Content-type: text/html\n\n&;
    print &Hello World&;

    to the bottom (before the exit;)..
     
  3. gorgo

    gorgo Well-Known Member

    Joined:
    Jan 9, 2002
    Messages:
    148
    Likes Received:
    0
    Trophy Points:
    16
    with perl scripts, it's end task is to display something... when your web browser requests the page, it asks for something back. Since the Perl script has nothing to display to the web browser, it just crashes out like you showed...

    So just remember, perl must ALWAYS have a content-type, and must always output something when a browser calls ;)
     
  4. Radio_Head

    Radio_Head Well-Known Member

    Joined:
    Feb 15, 2002
    Messages:
    2,051
    Likes Received:
    1
    Trophy Points:
    38
    [quote:82344361e7][i:82344361e7]Originally posted by (SH)Saeed[/i:82344361e7]

    Your script is not printing anything to the browser, not even sending a header..

    Try adding..

    print &Content-type: text/html\n\n&;
    print &Hello World&;

    to the bottom (before the exit;)..[/quote:82344361e7]

    Hello ,

    Thank you ( I am a php lover ;) )...

    however I added

    print &Content-type: text/html\n\n&;
    print &Hello World&;

    to the bottom (before the exit..

    but I am still receiving an Internal server error , using the browser ... (no error from command line) ..


    Thank you
     
  5. Radio_Head

    Radio_Head Well-Known Member

    Joined:
    Feb 15, 2002
    Messages:
    2,051
    Likes Received:
    1
    Trophy Points:
    38
    ok now works ;)

    Now , I am trying to execute a cron job on it but it doesn't work.
    Perhaps because there are anti spam restrictions ?
     
Loading...

Share This Page