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.

problem with cgi scripts displaying html?

Discussion in 'General Discussion' started by noimad1, Nov 13, 2006.

  1. noimad1

    noimad1 Well-Known Member

    Joined:
    Mar 27, 2003
    Messages:
    627
    Likes Received:
    0
    Trophy Points:
    16
    On one of my servers it appears that there is a problem with the cgi scripts.

    The code in the scripts themselves seems to be working fine, but if I try to print out html, the screen doesn't parse it. And it seems to be doing it to all of the scripts that are on the server, of which, most of them were working previously.

    Here is an example. If I do a script with:

    PHP:
    #!/usr/bin/perl

    print "<a href = test.html>testing</a>";
    the output is

    PHP:
    <a href test.html>testing</a>
    Anyone else experience this before?
     
  2. PWSowner

    PWSowner Well-Known Member

    Joined:
    Nov 10, 2001
    Messages:
    2,948
    Likes Received:
    3
    Trophy Points:
    38
    Location:
    ON, Canada
    Try putting this line ahead of the printing:
    print("Content-Type: text/html\n\n");
     
  3. noimad1

    noimad1 Well-Known Member

    Joined:
    Mar 27, 2003
    Messages:
    627
    Likes Received:
    0
    Trophy Points:
    16
    That worked. I noticed a lot of the scripts had this instead:

    The line : print "Content-type: text/plain";

    Now this seems to work fine in Internet explorer, but not in Mozilla.

    print "Content-type: text/html";

    works in both...

    Thanks,
    Damion
     
  4. PWSowner

    PWSowner Well-Known Member

    Joined:
    Nov 10, 2001
    Messages:
    2,948
    Likes Received:
    3
    Trophy Points:
    38
    Location:
    ON, Canada
    That's because IE is designed to make assumptions to attempt to correct some errors. Telling the browser it's plain text being sent will make most browsers simple show the code as plain text. All browsers except IE need to be told it's html.

    Never use IE when designing sites because you can have many errors without even knowing it, and IE is dropping in % usage.
     
Loading...

Share This Page