Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 272
  • Last Modified:

Cannot execute perl script in Home directory

I installed Perl 5.005 under my home directory on a sun os 4.1.3 and set the path, so that it precedes the older perl version on /usr/local/bin/perl. The problem is that the scripts now work only at the command line (perl script.pl) and crash from a browser (Permission denied). If I change the #! in the script to use the older perl, it works. Looks to me like installing Perl in a non-standard directory needs some additional configuration (env variables?)

Any ideas? (also, I cannot do a # ./test.pl, at the command line, with the new perl)

-sachin
0
sax
Asked:
sax
1 Solution
 
b2piCommented:
This is ugly, but there's not a lot of choice.

Set permissions to your home directory, and all directories in the path of the new perl (including the lib) to be globally executable.  i.e. if your perl is

/home/sax/perl/perl5.005

then

chmod a+Rx /home/sax
chmod a+Rx /home/sax/perl
chmod -R a+Rx /home/sax/perl/perl5.005

0
 
saxAuthor Commented:
I had already tried this option, with no luck.

Thanx
0
 
b2piCommented:
1.) Did you actually _install_ perl? (i.e. make install)?
2.) if ./test.pl does not work, what is the first line of test.pl?
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
saxAuthor Commented:
Yes. I installed perl (./configure, make, make test....and the whole procedure). All went off well.

The first line of the script is a #!<path to the perl on my home dir>. This is the same path that shows up, when I issue a $which perl.

If I replace my path to the /usr/local/bin/perl, ./test.pl works fine. The only other issue I have is, if it has anything to do with my homedirectory being NFS mounted from another machine (we use NIS). I am not sure if perl has to be "local" to the machine.

-sax
0
 
shchukaCommented:
I don't think it's an NFS problem, and Perl doesn't need to be on the local machines.  I used to manage a few machines withing the same NIS+ domain, where one machine had users directories and other had different applications.  These applications and users directories were NFS "cross"-mounted, so that they could be access from any machine - and it worked fine.

0
 
b2piCommented:
Hmmm.  Off chance.  How many modules are you using? (i.e.

use thismodule;
use thatmodule;


)?  Can you upload the output of perl -V from the old and the new perl?
0
 
saxAuthor Commented:
1. I do not use any modules. I am trying a 3 line perl script for testing.

2. Here is the output of perl -V:

Summary of my perl5 (5.0 patchlevel 5 subversion 2) configuration:
  Platform:
    osname=sunos, osvers=4.1.3_u1, archname=sun4-sunos
    uname='sunos psgserver 4.1.3_u1 3 sun4m '
    hint=recommended, useposix=true, d_sigaction=define
    usethreads=undef useperlio=undef d_sfio=undef
  Compiler:
    cc='gcc -B/bin/', optimize='-O', gccversion=2.7.2
    cppflags=''
    ccflags =''
    stdchar='unsigned char', d_stdstdio=define, usevfork=false
    intsize=4, longsize=4, ptrsize=4, doublesize=8
    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=8
    alignbytes=8, usemymalloc=y, prototype=define
  Linker and Libraries:
    ld='ld', ldflags ='-Lmath'
    libpth=/usr/local/lib /lib /usr/lib /usr/ucblib
    libs=-lnsl -ldbm -ldl -lm -lc -lposix
    libc=, so=so, useshrplib=false, libperl=libperl.a
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags=' '
    cccdlflags='-fpic', lddlflags='-assert nodefinitions -Lmath'


Characteristics of this binary (from libperl):
  Built under sunos
  Compiled at Oct  1 1998 14:40:07
  @INC:
    /people/services/sachin/local/perl/lib/5.00502/sun4-sunos
    /people/services/sachin/local/perl/lib/5.00502
    /people/services/sachin/local/perl/lib/site_perl/5.005/sun4-sunos
    /people/services/sachin/local/perl/lib/site_perl/5.005
    .

-thanx
0
 
pcrutchCommented:
Something small: your not using the ~username shortcut in the #! are you?  I had a problem with this (in HP-UX) -- apparently you have to use a fully qualified pathname..  just a thought..
0
 
mazaresCommented:
The problem may be with your web server, not pathing or permissions with your perl interpreter or your scripts. Some web servers require that you specify subdirectories in which cgi scripts can be executed. I encountered this when installing NS-Fasttrack on an HP9000. Just an idea...
0
 
tfabianCommented:
am I missing something here??

did you try putting the line


#!/path-of-your-home-directory-where-the-perl-is-located


as the first line of the perl executable..


eg. if your home direct is /home/smith

then you'ld put


   #!/home/smith


good luck


0

Featured Post

Become an Android App Developer

Ready to kick start your career in 2018? Learn how to build an Android app in January’s Course of the Month and open the door to new opportunities.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now