yeah i already added that to it but it is not working.
You haven't said yet whether any of your other cgi scripts run on your server. What happens when you run a really simple one? Such as:
#!/usr/bin/perl
#hello.cgi
use strict;
use warnings;
print "Content-type: text/html\n\n";
print "Hello, world!\n";
If that runs without error, then we can look at what is different about the bat file-calling script thatdoesn't work.
d5e5
Practically a Posting Shark
810 posts since Sep 2009
Reputation Points: 159
Solved Threads: 159
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."
d5e5
Practically a Posting Shark
810 posts since Sep 2009
Reputation Points: 159
Solved Threads: 159
You could try running the following, which incorporates one of solutions recommended in that article about buffering
#!C:\Perl\bin\perl.exe
#test.cgi
use strict;
use warnings;
#"The CGI::Carp module will arrange that fatal error messages
#are delivered to the browser with a simple prefabricated HTTP header,
#so that the browser displays the error message properly."
use CGI::Carp 'fatalsToBrowser';
print "Content-type: text/html\n\n"; #If no error, print your header anyway.
print "Try to run system 'jmeter -t'";
system 'jmeter -t';
I can't test it because my server platform is Linux, not Windows.
d5e5
Practically a Posting Shark
810 posts since Sep 2009
Reputation Points: 159
Solved Threads: 159