Skip to content Skip to sidebar Skip to footer

How To Set Ld_library_path For Apache+wsgi Website

I'm trying to use a python library in my wsgi( apache + flask) based website. While using the library in a standalone command script, I have to add the library path to LD_LIBRARY_

Solution 1:

Is the library required by a Python module extension you have compiled and installed? If it was, set LD_RUN_PATH environment variable to the directory the library is in when compiling and installing that Python module. That way the location is embedded in the Python module extension itself and you don't need LD_LIBRARY_PATH at run time.

The only other way to do it using environment variables is to set LD_LIBRARY_PATH in the startup scripts for Apache so that when Apache is started it is set as you require. This means fiddling with system startup scripts so is not ideal or always practical.

One final way which may work but isn't really that great of an idea and may not even work, is to use:

LoadFile "/usr/local/lib/libmylib.so"

in the Apache configuration. This will force linking of the specific library into Apache at startup, but depending on how the library is being used, this may not work.

Post a Comment for "How To Set Ld_library_path For Apache+wsgi Website"