[Discuss] Weird Apache backticks problem

pw p.willis at telus.net
Fri Oct 6 17:59:07 PDT 2006


Peter Scott wrote:
> Hi, I thought I'd try here first on this.  I'm installing TWiki on a 
> server that I don't control, and I have boiled a bizarre problem down to 
> this: a (perl) program that executes a command in backticks will work in 
> the cgi-bin directory, but hang elsewhere.  The program is no longer than
> 
>     print `/bin/ls`;
> 
> (after the content-type header) and it makes no difference what the 
> command in the `` is.  If I put anything else besides backticks in the 
> program it executes properly.  I have a .htaccess in the directory with 
> a SetHandler cgi-script directive.  The cgi-bin directory has no 
> .htaccess file.  The other directory is not a child of the cgi-bin but 
> is a couple of levels under htdocs, a sibling of cgi-bin.
> 
> I got nowhere Googling this.  There were some postings alleging a 
> similar problem on Windows servers but this is Linux (something called 
> vux by the look of it).  As a last resort I will have to figure out how 
> to install TWiki by moving its programs to a cgi-bin directory out of 
> its main tree, but I'd still like to know what the heck is going on here.


It may be a perl config thing.
When perl is built it finds the absolute path to
a bunch of commands. Perhaps perl is, internally,
appending an additional path onto the ls command.

Have you tried removing the path from the command?

ie:

print `ls`;

Also check to see that 'ls' is actually in '/bin'.
It may be moved elsewhere or could be a soft link.

Check the permissions on the directory you're trying to
list could be wierd or sticky bit or something.(obvious)

Do the forward slashes require backslash?(I don't think so...)

ie:

print `\/usr\/bin\/ls`;

Shots in the dark.....

Peter


More information about the Discuss mailing list