Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: Yet Another Premature End of Script Headers Question

by JediWizard (Deacon)
on Jul 19, 2005 at 16:36 UTC ( [id://476176]=note: print w/replies, xml ) Need Help??


in reply to Yet Another Premature End of Script Headers Question

I believe you need cariage return/new line combinations after the headers. Try:

#!/usr/bin/perl -w print "Content-type: text/html\r\n\r\n"; print "<HTML><HEAD>"; print "<TITLE>CGI Test</TITLE>"; print "</HEAD>"; print "<BODY><H2>Hello, world.</H2>"; print "</BODY></HTML>";

Also, might I recomend "use CGI"


They say that time changes things, but you actually have to change them yourself.

—Andy Warhol

Replies are listed 'Best First'.
Re^2: Yet Another Premature End of Script Headers Question
by brian_d_foy (Abbot) on Jul 19, 2005 at 21:23 UTC

    Don't confuse CGI output with network output. The CGI script's output is going to be fixed up by apache before it hits the network. The web server will take care of line endings and extra header information.

    For a simple script such as this one, you don't need CGI. You could use a heredoc though. :)

    #!/usr/bin/perl print <<"CGI"; Content-type: text/html <html> <head><title>CGI test</title></head> <body> <H2>Hello, world.</H2> </body> CGI
    --
    brian d foy <brian@stonehenge.com>
Re^2: Yet Another Premature End of Script Headers Question
by Anonymous Monk on Jul 19, 2005 at 17:14 UTC
    I've tried it with \r\n\r\n as well, and it doesn't work. RE: CGI: yes, I use CGI in the actual applications that I'm trying to install, but I want to get the simplest case working first.

    I'm still left with the question of why nothing more shows up in the Apache error log.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://476176]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (8)
As of 2024-04-23 13:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found