Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

"Content-Type" showing up at top of page

Status
Not open for further replies.

redsevens

IS-IT--Management
Aug 11, 2000
40
0
0
US
I am having trouble with a perl script that is running into segmentation faults (it is from a third party vendor) and their "support" pointed out that my Apache server is apparently sending header information, because their script shows "Content-Type: text/html" at the top of every page. While I don't think that would be causing their error, I would like to know why I can't output header information from the perl script. For example, the sample script
Code:
#!/usr/bin/perl
print "Content-Type: text/html\n\n";
print "This is a test.";
displays "Content-Type: text/html This is a test." on the browser screen.

I have mod_perl 1.21-10, PHP 4.0.3pl1, perl 5.00503-10 running on Apache 1.3.12-2 on Red Hat Linux 6.2. I tried removing the automatic content-type from my php.ini file just in case php was putting headers on everything, but that didn't work. Any suggestions about where this problem is coming from would be appreciated!

 
i think it should be:

print "Content-type: text/html\n\n";

i'm not sure if the browser is case sensitive about that, but, that might be the problem luciddream@subdimension.com
 
Try Calling this script from a html page...

Code:
<HTML>
<HEAD><TITLE>Sample</TITLE></HEAD>
<BODY>
<A HREF=&quot;./path/sample.pl&quot;>Sample Script</A>
</BODY>
</HTML>

I have had this before... If I run the pl script from the browser directly I get the Content-type stuff at the top of my browser... If you get the server to serve it it works..

Hope this helps...
 
Hi there.
I think the server is very much case sensitive. Have seen problems with that before.
 
Thank you for the tips...
The page I wrote up did have proper capitalization and I just mistyped it when posting here. But I appreciate the suggestion.

I also tried linking to it by a href tag, and then as a form action (both get and post methods) and none of these worked; I still got the Content-type line in the page.

Guess I'll keep trying different things...
 
Victory!
For those who like to take note of how to solve this type of problem, should it arise, here's the change I made to my httpd.conf file:
Code:
<Location /cgi-bin>    
#SetHandler perl-script
#PerlHandler Apache::Registry
Options +ExecCGI
Allow from all 
</location>
By commenting out the SetHandler and PerlHandler lines, it no longer assumes the headers, I guess. I haven't investigated all the repercussions of this change yet (such as performance) but there's only one perl script on the server, so screw large-scale performance. Yeah, that's right. And the 3rd party script still causes seg faults, but now they can stop trying to blame it on the content-type headers. Anybody know of a good web-based survey product?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top