I assume you have a binary and you can't modify the source?
If you use /sbin/sh, try this:
------------------------------------------
#!/sbin/sh
LD_LIBRARY_PATH=/lib:/usr/local/lib:/whatever
export LD_LIBRARY_PATH
/path-to-cgi-program/program-name
------------------------------------------
You might also try this wrapper:
------------------------------------------
#!/sbin/sh
LD_LIBRARY_PATH=/lib:/usr/local/lib:/whatever
export LD_LIBRARY_PATH
exec /path-to-cgi-program/program-name
------------------------------------------
I don't even think that the export is necessary, but it won't hurt. setenv
only works with csh/tcsh.
However, if this is a perl cgi script and the environment doesn't have
LD_LIBRARY_PATH, you could also try this:
p.138 "Programming Perl" 2nd edition
%ENV
The hash containing your current environment. Setting a value in %ENV
changes the environment for child processes:
$ENV{PATH} = "/bin:/usr/bin"
So try setting LD_LIBRARY_PATH
$ENV{LD_LIBRARY_PATH} = "/lib:/usr/local/lib:/whatever"
Quote:> I have a compiled cgi program that needs to have the LD_LIBRARY_PATH set
> in order to run. But the web client doesn't have this environment
> variable set when it runs the cgi. How does one handle this? I tried
> writing a shell script that had a setenv LD_LIBRARY_PATH command
> followed by a call to run the cgi program, but that didn't work.
> Any ideas?
> Thanks,
> Daniel
> --
> To reply to me directly, please remove "ANTISPAM" from the reply-to
> email address.