简体   繁体   中英

How to set LD_LIBRARY_PATH with apache

I'm attempting to run a flask app with mod_wsgi on Ubuntu 16.04. I'm having a problem setting the $LD_LIBRARY_PATH$ environment variable. I'm able to set this in my ~.bashrc file, and as a result I am able to import all my libraries and dependencies without a problem. However it seems apache seems to erase these environment variables.

The error I'm getting in my log file is the following

ImportError: libmkl_rt.so: cannot open shared object file: No such file or directory

There are two python libraries I'm importing that require mkl. The first doesn't seem to complain. However the second library cannot be imported due to the mkl error.

I find this odd so I recompiled the second python library after setting the $LD_RUN_PATH environment variable to the mkl paths. However it is still unable to find mkl.

How do I configure apache accordingly? All other imports work fine. I am able to run the flask scripts on their own without apache, so I'm pretty sure this is an apache problem.

if in you

/etc/sysconfig/httpd

add something like this

LD_LIBRARY_PATH=/my/library/path

then

apachectl restart httpd

should do the trick

apache by default use system lib path. so just add link of your so file to /usr/lib and then run command sudo ldconfig . perhaps problem will resolve

also this post may be helpful https://stackoverflow.com/a/23244452/6876911

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM