Gossamer Forum
Home : General : Perl Programming :

CGI not working under WinXP... plz help :)

Quote Reply
CGI not working under WinXP... plz help :)
Hi!

I have finally managed to install and set up Apache 2 server and PHP 4 on my Windows XP PC. Everything works fine, but I can't get CGI to work. I have installed Active Perl 5.8 in a "c:\perl" directory. I have found a manual how to set it up, and have followed it to the letter, but I can't run any CGI scripts in my browser. I have tries both *.cgi and *.pl extensions. The manual I have followed can be found on http://visca.com/...rl_apache_win9x.html I can run perl scripts in my command (DOS) window, so that means that perl is probably installed properly. When I try to open a webpage with the same code I get an 500 Internal Server Error. In the apache error logs the error is described as

[Wed Mar 12 17:45:53 2003] [error] [client 127.0.0.1] (OS 2)The system cannot find the file specified. : couldn't create child process: 720002: first.pl
[Wed Mar 12 17:45:53 2003] [error] [client 127.0.0.1] (OS 2)The system cannot find the file specified. : couldn't spawn child process: C:/localhost/cgi-bin/first.pl


Any help greatly appreciated,

Jerry

P.S. The apache config file should be attached (not sure how this works though :))
Quote Reply
Re: [jerryau] CGI not working under WinXP... plz help :) In reply to
OK, I have managed to get some things going but others don't. For example:

File "first.pl" - doesn't work

#!usr/bin/perl -w
print "Content-type: text/html\n\n";
print "Hello, World.";

BUT

File vegetables1.pl - does work

#!/usr/bin/perl
# Script: vegetables1.pl
use CGI::Pretty ':standard';
print header,
start_html('Vegetables'),
h1('Eat Your Vegetables'),
ol(
li('peas'),
li('broccoli'),
li('cabbage'),
li('peppers',
ul(
li('red'),
li('yellow'),
li('green')
)
),
li('kolrabi'),
li('radishes')
),
hr,
end_html;

Does anyone know why?
Quote Reply
Re: [jerryau] CGI not working under WinXP... plz help :) In reply to
Yes, I know why. Look at the first lines of the tow scripts.

Ivan
-----
Iyengar Yoga Resources / GT Plugins
Quote Reply
Re: [yogi] CGI not working under WinXP... plz help :) In reply to
Hm, I always thought Windows based system looked at the file extension and looked up the file association and ignored the shebang line?

- wil
Quote Reply
Re: [jerryau] CGI not working under WinXP... plz help :) In reply to
As Yogi pointed out your shebang line is missing a / in the script that fails.
Quote Reply
Re: [Paul] CGI not working under WinXP... plz help :) In reply to
Smile Thanks guys! I wouldn't have figured that one out.
Quote Reply
Re: [Wil] CGI not working under WinXP... plz help :) In reply to
In Reply To:
Hm, I always thought Windows based system looked at the file extension and looked up the file association and ignored the shebang line?
It depends how you have configured Apache.

You can set the configuration to read the shebang line, which makes it much easier to use switches.

AFAIK, PWS and IIS don't have that option.
Quote Reply
Re: [wysardry] CGI not working under WinXP... plz help :) In reply to
Ah, OK. But Apache 2 uses the system registry to read the file association by default -- and ignoes the shebang line.

- wil
Quote Reply
Re: [wysardry] CGI not working under WinXP... plz help :) In reply to
Quote:
You can set the configuration to read the shebang line

By default Apache 1 & 2 read the shebang line.

You'd have to customize httpd.conf to get it to ignore the shebang line. You'd just tell apache to parse .cgi or .pl files with perl.exe

Last edited by:

Paul: Mar 12, 2003, 5:13 AM
Quote Reply
Re: [Paul] CGI not working under WinXP... plz help :) In reply to
By default, Apache 2 reads the registry for the file association.

- wil
Quote Reply
Re: [Wil] CGI not working under WinXP... plz help :) In reply to
A default installation will not allow you to run a perl script without a shebang line.
Quote Reply
Re: [Paul] CGI not working under WinXP... plz help :) In reply to
If you installed Apache2 on Windows XP/2000 and then the latest version of Activestate Perl, it will allow you to run Perl scripts with #!/as/many/random/sentences/as/you/wish as your shebang line as long as your file extensions are right.

- wil
Quote Reply
Re: [Wil] CGI not working under WinXP... plz help :) In reply to
Well I have Apache 2.0.44 and Perl 5.6.1 Build 633 and that isn't the case.