problem with cgi scripts displaying html?

noimad1

Well-Known Member
Mar 27, 2003
629
0
166
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?
 

noimad1

Well-Known Member
Mar 27, 2003
629
0
166
Try putting this line ahead of the printing:
print("Content-Type: text/html\n\n");
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
 

PWSowner

Well-Known Member
Nov 10, 2001
2,948
4
343
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.