Solved

Cannot execute perl script in Home directory

Posted on 1998-10-06
10
253 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
10 Comments
 
LVL 5

Expert Comment

by:b2pi
Comment Utility
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
Comment Utility
I had already tried this option, with no luck.

Thanx
0
 
LVL 5

Expert Comment

by:b2pi
Comment Utility
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
 

Author Comment

by:sax
Comment Utility
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
Comment Utility
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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 5

Expert Comment

by:b2pi
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

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…
Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
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…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

771 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now