For Programmers: Free Programming Magazines  


Home > Archive > PERL Beginners > September 2007 > Strange error









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Strange error
Caronte

2007-09-25, 4:00 am

Hi everybody. I'm learning Perl and CGI programming using MAMP as web-
server on OSX and I can't use the standard CGI module. Look at this
(very) simple script:

#!/usr/local/bin/perl

use CGI ':standard';

print header();
print start_html();

for $i (param()) {
print "<b>", $i, "</b>: ", param($i), "<br>\n";
}

print end_html();

It should shows a blank page; on the contrary it outputs the following
error:
500 Server Error
[Mon Sep 24 21:00:38 2007] [error] [client ::1] (2)No such file or
directory: exec of '/Applications/MAMP/cgi-bin/backatcha-cgi' failed
[Mon Sep 24 21:00:38 2007] [error] [client ::1] Premature end of
script headers: backatcha-cgi

It works from the command line, anyway.
Scripts without cgi modules works instead.

Thanks for any help

Ken Foskey

2007-09-25, 7:00 pm

> 500 Server Error
> [Mon Sep 24 21:00:38 2007] [error] [client ::1] (2)No such file or
> directory: exec of '/Applications/MAMP/cgi-bin/backatcha-cgi' failed
> [Mon Sep 24 21:00:38 2007] [error] [client ::1] Premature end of
> script headers: backatcha-cgi


Why is there a hyphen not a dot?

backatcha.cgi

--
Ken Foskey
FOSS developer

Matthew Whipple

2007-09-25, 7:00 pm

Some suggestions:
rewrite ':standard'; as qw/:standard/;
use warnings;
check the web server error log for more verbose debugging information

It would be a lot easier to diagnose if you know what file or directory
isn't being found/accessed.

Caronte wrote:

Hi everybody. I'm learning Perl and CGI programming using MAMP as web-
> server on OSX and I can't use the standard CGI module. Look at this
> (very) simple script:
>
> #!/usr/local/bin/perl
>
> use CGI ':standard';
>
> print header();
> print start_html();
>
> for $i (param()) {
> print "<b>", $i, "</b>: ", param($i), "<br>\n";
> }
>
> print end_html();
>
> It should shows a blank page; on the contrary it outputs the following
> error:
> 500 Server Error
> [Mon Sep 24 21:00:38 2007] [error] [client ::1] (2)No such file or
> directory: exec of '/Applications/MAMP/cgi-bin/backatcha-cgi' failed
> [Mon Sep 24 21:00:38 2007] [error] [client ::1] Premature end of
> script headers: backatcha-cgi
>
> It works from the command line, anyway.
> Scripts without cgi modules works instead.
>
> Thanks for any help
>
>
>


Nobull67@Gmail.Com

2007-09-26, 10:00 pm

On Sep 24, 9:17 pm, caronte...@libero.it (Caronte) wrote:
> Hi everybody. I'm learning Perl and CGI programming using MAMP as web-
> server on OSX and I can't use the standard CGI module. Look at this
> (very) simple script:
>
> #!/usr/local/bin/perl


First obvious question, is that the correct path?

> [Mon Sep 24 21:00:38 2007] [error] [client ::1] (2)No such file or
> directory: exec of '/Applications/MAMP/cgi-bin/backatcha-cgi' failed


Second obvious question, is that the correct path?

Caronte

2007-09-26, 10:00 pm

On 25 Set, 12:37, mwhip...@kothartech.com (Matthew Whipple) wrote:[color=darkred]
> Some suggestions:
> rewrite ':standard'; as qw/:standard/;
> use warnings;
> check the web server error log for more verbose debugging information
>
> It would be a lot easier to diagnose if you know what file or directory
> isn't being found/accessed.
>
> Caronte wrote:
>
> Hi everybody. I'm learning Perl and CGI programming using MAMP as web-
>
>
>
>
>
>
>
>
>

False alarm. The problem was the intepreter directory; I fixed it
replacing the first line with "#!/usr/bin/perl"...I'm a little
ashamed :-).
Ken, Matthew thank you for your answers.

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com