hi guys, the code below works fine:
#!C:\Perl\bin\perl.exe
print "Content-type: text/html\n\n";
print "HELLO \nWORLD!\n";
i am using windows system, and i called using the url http://localhost/cgi-bin/hello.cgi. so this works fine.
please tell how i will associate cgi with perl executable in the httpd.conf, aalthough i have examined this critically.
To d5e5: the script below works fine wen i ran from command prompt, the problem is calling it from a browser.
#!C:\Perl\bin\perl.exe
print "Content-type: text/html\n\n";
system "jmeter";
Since
http://localhost/cgi-bin/hello.cgi runs OK on your server it seems to me your server already associates cgi with perl, so maybe you don't have to touch httpd.conf. I have to do something else right now but I hope to get back online this afternoon and have another look at this.
What I suspect is that the print buffering, if any, is causing a problem. Maybe the output from the called bat file is somehow preceding the "Content-type: text/html\n\n" in the print buffer. If the output arrives at the browser in the wrong sequence, that can cause the error you are getting. In the meanwhile, have a look at
http://perl.plover.com/FAQs/Buffering.html
The following passage looks interesting: "The content-type and the title are printed to STDOUT, which is buffered, but [...some error...] message is printed to STDERR, which isn't buffered. Result: The content-type and title are buffered. Then the error message comes out, and then, when the program exits, the STDOUT buffer is flushed and the content-type and title come out at last. The server was expecting to see the Content-type line right away, gets confused because it appears to be missing, and reports an error."