in reply to Re: real static perl
in thread real static perl

If all you have is FTP access, you probably won't be able to do things like make the file (perl executable) executable as far a linux goes.

Strictly speaking, on Linux, an executable doesn't need to be executable :)  You can always run it directly via the dynamic loader. If you don't believe it, try the following:

Copy the perl binary to some temp directory

$ cp `which perl` /tmp

Remove the executable bit

$ chmod -x /tmp/perl $ ls -l /tmp/perl -rw-r--r-- 1 ab ab 1061700 Apr 20 00:47 /tmp/perl

Now, if you try to run it normally, you'd of course get

$ /tmp/perl -v bash: /tmp/perl: Permission denied

but if you use the dynamic loader, it works without a hitch

$ /lib/ld-linux.so.2 /tmp/perl -v This is perl, v5.8.8 built for x86_64-linux-thread-multi (...)
Also depending on the setup, you could potentially not have access to your rc files (bashrc, cshrc, bash_profile) and would thus be unable to set environment variables needed

You don't necessarily need to. If you have mod_env available, you can conveniently set them from your apache config (e.g. for the CGI directory in question):

SetEnv LD_LIBRARY_PATH /path/to/private/shared/libs

This even works with .htaccess files, so you don't need write access to the main httpd.conf. Also, as I tried to point out, it's probably not even a good idea to set LD_LIBRARY_PATH system-wide from some rc file (too many side effects if you mess with important libs on that scale...).

Replies are listed 'Best First'.
Re^3: real static perl
by marc_ (Deacon) on Apr 20, 2007 at 16:59 UTC
    almut,

    congrats (and ++) ... you just tought an old dog a new trick. 10+ years in UNIX/Linux and I've never seen the ld-linux trick (well i may have but forgotten). i like it, thanks!!

    no time to get into the rest ... never tried setting ENV vars in a .htaccess, not saying you're wrong, just never tried it. in a nutshell, my basic argument against the rest of the post is that if bobb doesn't have access enough to do the things suggested, he certainly won't have access to the httpd.conf, apachectl or global LD_LIBRARY_PATH (i know you suggest against it as i would agree). on the .htaccess ENV thing, would that work? the file would be in some user's directory but httpd would most likely not be running as that user. i've never needed to look but this would make sense only if the CGI was executed as the user who owned it, not the user running the httpd process (nobody, daemon whomever).

    anyway, thanks for the cool trick and for making me think!!

    --marc