Link to home
Start Free TrialLog in
Avatar of sax
sax

asked on

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
Avatar of b2pi
b2pi
Flag of United States of America image

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

Avatar of sax
sax

ASKER

I had already tried this option, with no luck.

Thanx
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?
Avatar of sax

ASKER

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
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.

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?
Avatar of sax

ASKER

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
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..
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...
ASKER CERTIFIED SOLUTION
Avatar of tfabian
tfabian

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial