Hi All I am trying to run the simplest of perl scripts. However when in Internet Explorer as in Mozilla as in Firefox i always get the same error message http://peterspretpaleis.dyndns.org:8000/cgi-bin/guestbook.cgi Premature end of script headers: guestbook.cgi the contens of this script is #!/usr/bin/perl print ?Content-type: text/html\n\n?; print ?< html> ?; print ?< body> ?; print ?< h2> I just wrote my first web page using Perl!< /h2> ?; print ?< /body> ?; print ?< /html> ?; http://www.novell.com/coolsolutions/feature/11790.html and perl finds the syntax ok can someone shed some light on this or direct me to a place where i might find the answer? I think it would be nice to use perl with apache2 or even create my own perl scripts Thanx for your reply
peter thesing wrote:
Hi All
I am trying to run the simplest of perl scripts. However when in Internet Explorer as in Mozilla as in Firefox i always get the same error message http://peterspretpaleis.dyndns.org:8000/cgi-bin/guestbook.cgi Premature end of script headers: guestbook.cgi
the contens of this script is
#!/usr/bin/perl print ?Content-type: text/html\n\n?; print ?< html> ?; print ?< body> ?; print ?< h2> I just wrote my first web page using Perl!< /h2> ?; print ?< /body> ?; print ?< /html> ?;
http://www.novell.com/coolsolutions/feature/11790.html
and perl finds the syntax ok
can someone shed some light on this or direct me to a place where i might find the answer?
I think it would be nice to use perl with apache2 or even create my own perl scripts
Thanx for your reply
You should have a look at the apache log files in /var/log/apache2 Look for error_log and access_log. There you should find the answer. Ulf
Ulf Rasch wrote:
peter thesing wrote:
Hi All
I am trying to run the simplest of perl scripts. However when in Internet Explorer as in Mozilla as in Firefox i always get the same error message http://peterspretpaleis.dyndns.org:8000/cgi-bin/guestbook.cgi Premature end of script headers: guestbook.cgi
the contens of this script is
#!/usr/bin/perl print ?Content-type: text/html\n\n?; print ?< html> ?; print ?< body> ?; print ?< h2> I just wrote my first web page using Perl!< /h2> ?; print ?< /body> ?; print ?< /html> ?;
http://www.novell.com/coolsolutions/feature/11790.html
and perl finds the syntax ok
can someone shed some light on this or direct me to a place where i might find the answer?
I think it would be nice to use perl with apache2 or even create my own perl scripts
Thanx for your reply
You should have a look at the apache log files in /var/log/apache2 Look for error_log and access_log. There you should find the answer.
Ulf
Hi from error_log [Fri Sep 30 19:32:50 2005] [error] [client 194.109.22.149] Premature end of script headers: guestbook.cgi still it gives the same error message but no answers from acces_log peter:/var/log/apache2 # tail -f access_log | grep guestbook.cgi 10.0.0.157 - - [30/Sep/2005:19:08:50 +0200] "GET /cgi-bin/guestbook.cgi HTTP/1.1 " 500 1005 "-" "Mozilla/5.0 (Windows; U; Win98; nl-NL; rv:1.7.10) Gecko/20050717 the file is found but not executed sorry to say but can someone help me to find the answer? thanx
On Friday 30 September 2005 19:29, peter thesing wrote: [--snip--]
You should have a look at the apache log files in /var/log/apache2 Look for error_log and access_log. There you should find the answer.
Ulf
Hi from error_log [Fri Sep 30 19:32:50 2005] [error] [client 194.109.22.149] Premature end of script headers: guestbook.cgi still it gives the same error message but no answers from acces_log peter:/var/log/apache2 # tail -f access_log | grep guestbook.cgi 10.0.0.157 - - [30/Sep/2005:19:08:50 +0200] "GET /cgi-bin/guestbook.cgi HTTP/1.1 " 500 1005 "-" "Mozilla/5.0 (Windows; U; Win98; nl-NL; rv:1.7.10) Gecko/20050717 the file is found
but not executed sorry to say but can someone help me to find the answer? thanx
Well, have you executed your script? You should see the output that will be sent to the browser. The script you are trying compiles but produces NO output. Try this: #!/usr/bin/perl print "Content-type: text/html\n\n"; print "<html>"; print "<body>"; print "<h2>I just wrote my first web page using Perl!</h2>"; print "</body>"; print "</html>" ; Run the script first from the command line. You should see output. If your server doesn't display it as a webpage check the permissions etc. In general cgi is quite simple. All standard output will be directed to the browser and all errors should go to error_log. So just executing the cgi script/program should produce output on the command line. Ulf
On Fri, 2005-09-30 at 17:17 +0200, peter thesing wrote:
Hi All
I am trying to run the simplest of perl scripts. However when in Internet Explorer as in Mozilla as in Firefox i always get the same error message http://peterspretpaleis.dyndns.org:8000/cgi-bin/guestbook.cgi Premature end of script headers: guestbook.cgi
google for Matt's script archive. I remember he has helps on his site. CWSIV
On Fri, 2005-09-30 at 17:17 +0200, peter thesing wrote:
Hi All
I am trying to run the simplest of perl scripts. However when in Internet Explorer as in Mozilla as in Firefox i always get the same error message http://peterspretpaleis.dyndns.org:8000/cgi-bin/guestbook.cgi Premature end of script headers: guestbook.cgi
the contens of this script is
#!/usr/bin/perl print ?Content-type: text/html\n\n?; print ?< html> ?; print ?< body> ?; print ?< h2> I just wrote my first web page using Perl!< /h2> ?; print ?< /body> ?; print ?< /html> ?;
first content type needs to be a meta tag like this <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> drop the last semicolon #!/usr/bin/perl print "<html>\n"; print "<head>\n"; print ""; print "</head>\n"; print "<body>\n"; print "<h2>I just wrote my first web page using Perl!</h2>\n"; print "</body>\n"; print "</html>" I played around for a few minutes as I am just beginning with perl. You will need to embed double quotes to make the meta tag work and not display when the page does. Note I added \n to make a legable output. CWSIV
* Carl William Spitzer IV
I played around for a few minutes as I am just beginning with perl. You will need to embed double quotes to make the meta tag work and not display when the page does. Note I added \n to make a legable output.
That's odd. I copied verbatim, his example to a file and it displayed as expected. -- Patrick Shanahan Registered Linux User #207535 http://wahoo.no-ip.org @ http://counter.li.org HOG # US1244711 Photo Album: http://wahoo.no-ip.org/gallery2
On Wed, 2005-10-05 at 22:34 -0500, Patrick Shanahan wrote:
* Carl William Spitzer IV
[10-05-05 21:42]: I played around for a few minutes as I am just beginning with perl. You will need to embed double quotes to make the meta tag work and not display when the page does. Note I added \n to make a legable output.
That's odd. I copied verbatim, his example to a file and it displayed as expected.
In mozilla verbatim copy produced a displayed meta tag. -- ___ _ _ _ ____ _ _ _ | | | | [__ | | | |___ |_|_| ___] | \/
-- snip --
first content type needs to be a meta tag like this <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> drop the last semicolon
#!/usr/bin/perl print "<html>\n"; print "<head>\n"; print ""; print "</head>\n"; print "<body>\n"; print "<h2>I just wrote my first web page using Perl!</h2>\n"; print "</body>\n"; print "</html>"
Your script will work for generating html but not as a CGI script. Regarding CGI you have to provide a header that hints the browser what kind of data to expect. The first line of output (to standard output) should be (the mime type) Content-Type: text/html in this case. You would have to add print "Content-Type: text/html\n\n"; as the first output line to your script. You can provide other headers to inform the browser of a new location or the content you will send is an image etc. For more info on that have a look at: http://hoohoo.ncsa.uiuc.edu/cgi/out.html -- "Whatever the missing mass of the universe is, I hope it's not cockroaches!" -- Mom
participants (4)
-
Carl William Spitzer IV
-
Patrick Shanahan
-
peter thesing
-
Ulf Rasch