Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Perl/Apache/CGI problem 2

Status
Not open for further replies.

JennyW

Technical User
Joined
Mar 1, 2001
Messages
323
Location
CA
Hi,

I have Apache running off a console on Windows 98.
I also have Perl on my PC.
I trying to test CGI scripts.

I tried testing the CGI script below, named simple.cgi ( but had NO success...
(script supplied by goboating)...


#!perl
print "Content-type: text/html\n\n";
print "Not Hello, again!\n";


Is the #!perl line the problem?
Should that line display the exact path to perl.exe like this...
#!c:/program files/perl/bin

------------------------------

I also checked my Apache log files...

access.log

127.0.0.1 - - [13/May/2001:18:29:57 -0400] "GET / HTTP/1.1" 200 1354
127.0.0.1 - - [13/May/2001:18:29:58 -0400] "GET /apache_pb.gif HTTP/1.1" 200 2326
127.0.0.1 - - [13/May/2001:18:31:31 -0400] "GET /manual/ HTTP/1.1" 200 5740
127.0.0.1 - - [13/May/2001:18:31:31 -0400] "GET /manual/images/apache_header.gif HTTP/1.1" 200 4084
127.0.0.1 - - [13/May/2001:18:31:31 -0400] "GET /manual/images/pixel.gif HTTP/1.1" 200 61
127.0.0.1 - - [13/May/2001:18:34:03 -0400] "GET / HTTP/1.1" 200 1354
127.0.0.1 - - [13/May/2001:18:52:14 -0400] "GET / HTTP/1.1" 200 1354
127.0.0.1 - - [13/May/2001:21:59:00 -0400] "GET / HTTP/1.1" 200 1354
127.0.0.1 - - [13/May/2001:21:59:00 -0400] "GET /apache_pb.gif HTTP/1.1" 304 -
127.0.0.1 - - [14/May/2001:20:44:28 -0400] "GET / HTTP/1.1" 200 1354
127.0.0.1 - - [14/May/2001:20:44:28 -0400] "GET /apache_pb.gif HTTP/1.1" 304 -
127.0.0.1 - - [14/May/2001:20:45:20 -0400] "GET /cgi-bin/ScriptName HTTP/1.1" 404 312
127.0.0.1 - - [14/May/2001:20:45:39 -0400] "GET /cgi-bin/printenv.pl HTTP/1.1" 500 634
127.0.0.1 - - [14/May/2001:20:46:37 -0400] "GET /cgi-bin/first HTTP/1.1" 404 307
127.0.0.1 - - [15/May/2001:18:20:05 -0400] "GET /cgi-bin/simple.cgi HTTP/1.1" 404 312
127.0.0.1 - - [15/May/2001:18:42:45 -0400] "GET / HTTP/1.1" 200 1354
127.0.0.1 - - [15/May/2001:18:42:46 -0400] "GET /apache_pb.gif HTTP/1.1" 304 -
127.0.0.1 - - [15/May/2001:18:43:29 -0400] "GET /cgi-bin/simple.cgi HTTP/1.1" 500 634
127.0.0.1 - - [15/May/2001:22:04:15 -0400] "GET /cgi-bin/simple.cgi HTTP/1.1" 500 634
127.0.0.1 - - [16/May/2001:20:27:53 -0400] "GET / HTTP/1.1" 200 1354
127.0.0.1 - - [16/May/2001:20:27:53 -0400] "GET /apache_pb.gif HTTP/1.1" 304 -
127.0.0.1 - - [16/May/2001:20:30:06 -0400] "GET / HTTP/1.1" 200 1354
127.0.0.1 - - [16/May/2001:20:30:34 -0400] "GET /cgi-bin/simple.cgi HTTP/1.0" 500 622


error.log

Apache server shutdown initiated...
Apache server shutdown initiated...
[Mon May 14 20:45:20 2001] [error] [client 127.0.0.1] (2)No such file or directory: script not found or unable to stat: c:/program files/apache group/apache/cgi-bin/scriptname
[Mon May 14 20:45:39 2001] [error] [client 127.0.0.1] couldn't spawn child process: c:/program files/apache group/apache/cgi-bin/printenv.pl
[Mon May 14 20:46:37 2001] [error] [client 127.0.0.1] (2)No such file or directory: script not found or unable to stat: c:/program files/apache group/apache/cgi-bin/first
[Tue May 15 18:20:05 2001] [error] [client 127.0.0.1] (2)No such file or directory: script not found or unable to stat: c:/program files/apache group/apache/cgi-bin/simple.cgi
[Tue May 15 18:43:29 2001] [error] [client 127.0.0.1] couldn't spawn child process: c:/program files/apache group/apache/cgi-bin/simple.cgi
[Tue May 15 22:04:15 2001] [error] [client 127.0.0.1] couldn't spawn child process: c:/program files/apache group/apache/cgi-bin/simple.cgi
[Wed May 16 20:30:34 2001] [error] [client 127.0.0.1] couldn't spawn child process: c:/program files/apache group/apache/cgi-bin/simple.cgi


Does this tell you anything?

Could the problem lie within my Perl installation? How can I check if Perl is OK?

Thanks,
Jenny
 
hmm. i'm not sure how apache handles spaces in the shebang line. try #!c:/progra~1/perl/bin/perl.exe instead. also, in your httpd.conf file, set the error level to 'debug', and it will give you more detailed errors than it is (i think).

and if you're worried about your perl installation, open up console window, type[tt]
perl -e "print qq~Not hello, again...\n~;"[/tt]

and that'll work if perl is installed correctly(and is in your PATH). "If you think you're too small to make a difference, try spending a night in a closed tent with a mosquito."
 
Hi,

Stillframe,

Thanks for the response. How do I set the error level to debug in the httpd.conf file.

Thanks,
Jenny
 
I'm on Redhat 6.1 Linux - I've never set this manually(I've always taken the default), but here's LogLevel in httpd.conf:

#
# LogLevel: Control the number of messages logged to the error_log.
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
#

I haven't looked through the whole thing, but 'LogLevel' looks like it might be what you're looking for.

HTH.
Hardy Merrill
Mission Critical Linux, Inc.
 
Hiee,

How can I open up a console window in perl? What do I open (double click)?

hrmerrill, where did you get Loglevel from?
What does that do? Where would I insert it?

How can I set the error leve to debug?

Thanks,
Jenny
 
loglevel is in the httpd.conf file, search for it, and when you find it, set it to debug.

as for console window, i'm not sure what you mean. you might mean just the msdos consol, which you can get from Start Menu->Run and type in 'command'...

? "If you think you're too small to make a difference, try spending a night in a closed tent with a mosquito."
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top