[Tutor] setting environment variables in apache

Lance E Sloan lsloan@umich.edu
Tue, 15 May 2001 14:29:00 -0400


Suzanne Little wrote:
> Phew! Sorry should have finished reading the deja search results before I
> posted. I've written a little wrapper script to set the variable, as
> below, which appears to have solved the problem. Apparently either doing
> this or using some thing in apache called SetEnv is the only way to do
> this.
>
> #!/usr/local/bin/bash
> LD_LIBRARY_PATH=/opt/local/lib:/opt/local/lib/mysql
> export LD_LIBRARY_PATH
> /.../bootup3.py

Yes, you're right.  The error comes from Python not being able to
find the shared library it needs.  It's too late to fix it from
within a Python script.  I had problems like this right after I
built Python (and Perl, too).  What I ended up doing is relinking
Python using the "-R" option and giving the path to the library it
was looking for.  That option sets the "RPATH" in the executable,
which is used in addition to the path in the "LD_LIBRARY_PATH"
environment variable.

You won't need a wrapper after that.  I think you could also set
"LD_LIBRARY_PATH" in Apache's config, but that's not the best way
to hand the problem, either.

--
Lance E Sloan
Web Services, Univ. of Michigan: Full-service Web and database design,
development, and hosting.  Specializing in Perl & Python CGIs.
http://websvcs.itd.umich.edu/ - "Putting U on the Web"