Perl CGI scripts won't run without -w switch (under Apache 1.3.x) 
Author Message
 Perl CGI scripts won't run without -w switch (under Apache 1.3.x)

Hi All,

I have a strange problem, which I cannot work out. Some of my cgi scripts
won't run unless the shebang line for perl contains the -w flag. I
haven't been able to see anything which might distinguish the scripts
which require this from those that don't. I was wondering if anyone else
has come across this problem or if anyone has any suggestions.

TIA
Rick

PS. Below are the two lines which appear in the server error logs for
those scripts which require the -w flag but are run without it:

[Mon Mar  4 11:02:53 2002] [error] (2)No such file or directory: exec of
/var/www/cgi-bin/stressfreeway/protect/admin.cgi failed
 [Mon Mar  4 11:02:53 2002] [error] [client 195.92.113.26] Premature end
of script headers: /var/www/cgi-bin/stressfreeway/protect/admin.cgi



Fri, 20 Aug 2004 12:12:55 GMT  
 Perl CGI scripts won't run without -w switch (under Apache 1.3.x)

Quote:
> Hi All,

> I have a strange problem, which I cannot work out. Some of my cgi scripts
> won't run unless the shebang line for perl contains the -w flag. I
> haven't been able to see anything which might distinguish the scripts
> which require this from those that don't. I was wondering if anyone else
> has come across this problem or if anyone has any suggestions.

Check the line feed at the end ot th shebang line.  It's very likely
not what it should be under the system it's running on.

Anno



Fri, 20 Aug 2004 12:18:56 GMT  
 Perl CGI scripts won't run without -w switch (under Apache 1.3.x)

Quote:

> I have a strange problem, which I cannot work out. Some of my cgi scripts
> won't run unless the shebang line for perl contains the -w flag. I
> haven't been able to see anything which might distinguish the scripts
> which require this from those that don't. I was wondering if anyone else
> has come across this problem or if anyone has any suggestions.
> PS. Below are the two lines which appear in the server error logs for
> those scripts which require the -w flag but are run without it:

> [Mon Mar  4 11:02:53 2002] [error] (2)No such file or directory: exec of
> /var/www/cgi-bin/stressfreeway/protect/admin.cgi failed

I suspect that there are some weird characters in the shebang line.
Consider this:

#! /usr/bin/perl^C

and

#! /usr/bin/perl -w^C

where ^C stands for any non-printable character.

In the first case this wont work since not /usr/bin/perl is invoked but
rather /usr/bin/perl + weird_character. The second version may work
because at least the interpreter is correctly recognized.

Have you perhaps transfered your scripts from a win-machine using ftp
without setting the mode to ascii?

Tassilo
--

pam{rekcahbus;})(rekcah{lrePbus;})(lreP{rehtonabus;})(rehtona{tsuJbus!;
$_=reverse;s/sub/(reverse"bus").chr(32)/xge;tr~\n~~d;eval;



Fri, 20 Aug 2004 12:22:30 GMT  
 Perl CGI scripts won't run without -w switch (under Apache 1.3.x)

<SNIP>

Thanks to both of you who replied! This is exactly the problem. The
scripts in question were indeed transferred from a win machine. Some
scripts which were uploaded from both the problem-causing machines do work,
but only those scripts which have never been saved in a windows editor (I
assume).

Thanks again
Rick



Fri, 20 Aug 2004 13:09:20 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. can't run CGI scripts in Apache...help please

2. Please Help:My script runs on win32, it won't run on Unix

3. My script runs on win32, it won't run on Unix

4. Please Help: My script runs on win32, it won't run on Unix

5. Perl CGI won't fork with mod_perl in Apache

6. perl in cgi-bin of apache in win98 won't work

7. perl 4 script that won't run under perl 5

8. script won't run...displays script text

9. Newbie help--perl won't run as CGI

10. can't run a java App with my perl script using apache

11. Perl scripts won't run on Linux

12. IIS4.0 won't run perl scripts which call external commands

 

 
Powered by phpBB® Forum Software