Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid

Scripts (mostly) doing nothing when run from command line.

by graq (Curate)
on Jan 06, 2007 at 19:49 UTC ( #593328=perlquestion: print w/replies, xml ) Need Help??
graq has asked for the wisdom of the Perl Monks concerning the following question:

The perl scipts on my RedHat FC4 box are behaving strangely (as far as I can tell). The scripts error when run via the browser: Can't open perl script "/dir/": Permission denied

I've ensured that the permissions are correct (to the point of recursively chmodding everything in /var/www to world read and execute).

I created a small Hello World script (double checking that the shebang line was correct) in the cgi-bin directory - with the same problems. I ran the HW script from the command line with the syntax perl (which worked) and then ran it with the syntax ./ (which did not work). The second syntax had an effect as if I just hit the return key - it did nothing.

I then copied the script to my home directory and tried both syntaxes - they both worked. I then created and tried to replicate this behaviour, but, sadly, this script did not work using the second syntax from my home directory.

I'm stumped. I've pasted my experience below.

~>cd /var/www/cgi-bin /var/www/cgi-bin>cat #!/usr/bin/perl print "Content-type: text/html\n\n"; print "Hello World\n"; /var/www/cgi-bin>which perl /usr/bin/perl /var/www/cgi-bin>perl Content-type: text/html Hello World /var/www/cgi-bin>./ /var/www/cgi-bin>cp ~ /var/www/cgi-bin>cd ~>perl Content-type: text/html Hello World ~>./ Content-type: text/html Hello World ~>cd /var/www/cgi-bin /var/www/cgi-bin>cat #!/usr/bin/perl print "Content-type: text/html\n\n"; print "Hello World2\n"; /var/www/cgi-bin>perl Content-type: text/html Hello World2 /var/www/cgi-bin>./ /var/www/cgi-bin>cp ~ /var/www/cgi-bin>cd ~>perl Content-type: text/html Hello World2 ~>./ ~>diff ~>

EDIT 1: Specifically, all the scripts *are* executable.

EDIT2: ls -l /usr/bin/perl `which perl` -rwxr-xr-x 2 root root 15660 Mar 13 2006 /usr/bin/perl -rwxr-xr-x 2 root root 15660 Mar 13 2006 /usr/bin/perl

-=( Graq )=-

Replies are listed 'Best First'.
Re: Scripts (mostly) doing nothing when run from command line.
by gaal (Parson) on Jan 06, 2007 at 20:09 UTC

      Yes, that seems to be exactly what the problem is.

      Just to keep this SoPW complete: running /usr/bin/setenforce 0 as root appears to have fixed the problerm.

      Thank you.

      -=( Graq )=-

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://593328]
Approved by Corion
and the monks are chillaxin'...

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (5)
As of 2017-05-28 09:17 GMT
Find Nodes?
    Voting Booth?