Solved

Cannot execute perl script in Home directory

Posted on 1998-10-06
10
258 Views
Last Modified: 2010-03-05
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
Comment
Question by:sax
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
10 Comments
 
LVL 5

Expert Comment

by:b2pi
ID: 1205154
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
 

Author Comment

by:sax
ID: 1205155
I had already tried this option, with no luck.

Thanx
0
 
LVL 5

Expert Comment

by:b2pi
ID: 1205156
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!

 

Author Comment

by:sax
ID: 1205157
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
 
LVL 2

Expert Comment

by:shchuka
ID: 1205158
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
 
LVL 5

Expert Comment

by:b2pi
ID: 1205159
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
 

Author Comment

by:sax
ID: 1205160
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
 

Expert Comment

by:pcrutch
ID: 1205161
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
 

Expert Comment

by:mazares
ID: 1205162
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
 
LVL 5

Accepted Solution

by:
tfabian earned 50 total points
ID: 1205163
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

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!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I've just discovered very important differences between Windows an Unix formats in Perl,at least 5.xx.. MOST IMPORTANT: Use Unix file format while saving Your script. otherwise it will have ^M s or smth likely weird in the EOL, Then DO NOT use m…
Email validation in proper way is  very important validation required in any web pages. This code is self explainable except that Regular Expression which I used for pattern matching. I originally published as a thread on my website : http://www…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question