Welcome to WebmasterWorld Guest from

Forum Moderators: coopster & jatar k & phranque

Message Too Old, No Replies

mod perl: Page outputs source code

Need help getting mod_perl working correctly

1:35 am on Oct 6, 2008 (gmt 0)

Junior Member

10+ Year Member

joined:Feb 29, 2004
votes: 0

Hi All,

I have searched around the forums but cannot find an answer to my mod_perl troubles.

Basically i finally got mod_perl working where it will interpret the script BUT when i view the script on this server via a browser i get a complete dump of the page's HTML source code.

All perl code is interpreted correctly, but it's like the page's header is not being sent over correctly?

On a different server that has mod_perl working correctly, i can access the exact same script/source code and the page renders correctly.

Any pointers on where i can look?

This is an ubuntu/apache2 setup.

Thank you!

PS: Here is the start of the script im running if it helps?


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

###Find where we are
$pwd = join('',<PWD>);
$pwd =~ s/\n//gi;
close PWD;

### Find the system date
open(DT, 'date "+DATE: %Y-%m-%d%n<br>TIME: %H:%M:%S"');
$dt = join('', <DT>);
$dt =~ s/\n//gi;
close DT;

print "<HEAD><TITLE>Advanced Whereami.cgi</TITLE></HEAD>\n";
print "<body bgcolor='#CC3399' text='#000000'>\n";


[edited by: phranque at 8:17 am (utc) on Oct. 6, 2008]
[edit reason] disabled smileys ;) [/edit]

8:27 am on Oct 6, 2008 (gmt 0)


WebmasterWorld Administrator phranque is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:Aug 10, 2004
votes: 106

maybe it's not sending a correct HTTP Response header and/or you're getting a text/plain content type in front of your document.
have a look at this documentation and see if anything there works for your situation:
4:30 pm on Oct 6, 2008 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Feb 16, 2004
votes: 0

You are missing the opening <HTML> tag... and you may want to send a DTD ahead of it.
6:46 pm on Oct 6, 2008 (gmt 0)

Junior Member

10+ Year Member

joined:Feb 29, 2004
votes: 0

phranque... Thank you sir!

PerlSendHeader On

was needed in my location def within /etc/apache2/apache2.conf