Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

"Content-Type" showing up at top of page

"Content-Type" showing up at top of page

"Content-Type" showing up at top of page

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

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!

RE: "Content-Type" showing up at top of page

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


RE: "Content-Type" showing up at top of page

Try Calling this script from a html page...

<A HREF="./path/sample.pl">Sample Script</A>

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...

RE: "Content-Type" showing up at top of page

Hi there.
I think the server is very much case sensitive. Have seen problems with that before.

RE: "Content-Type" showing up at top of page

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...

RE: "Content-Type" showing up at top of page

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:

<Location /cgi-bin>    
#SetHandler perl-script
#PerlHandler Apache::Registry
Options +ExecCGI
Allow from all

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?

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close