POKův kanál

pokův kanál

webdesign, linux a blog

Using informixdb from mod_wsgi application

17. 05. 2012, 11.16

I was given mod_wsgi application using IBM Informix as database backend. That application uses informixdb as python driver for that db. For some reason, that pyhon module requires some variables in environment, so it knows where lo look for IBM Informix client libraries. These are (in mine case):

$ cat /etc/profile.d/informix.sh export INFORMIXDIR=/opt/IBM/informix export PATH=$PATH:/opt/IBM/informix/bin export LD_LIBRARY_PATH=/opt/IBM/informix/lib:/opt/IBM/informix/lib/esql/

I have this in /etc/profile.d/, so each time I login, I have these variables in my environment and I was able to work with development instance of the application. And here comes the problem. When I ran the application using apache (using mod_wsgi), it have nice and clean environment. I was getting tracebacks with:

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

Solution was to source the informix.sh script with required variables into /etc/sysconfig/httpd, so when apache init.d startup script starts, it is sourced and apache have these variables in its environment.

$ tail -n 1 /etc/sysconfig/httpd . /etc/profile.d/informix.sh

Starší příspěvky...

Heslo musí obsahovat minimálně 18770 znaků a nesmí to být žádné z předchozích 30689 hesel. Zadejte jiné heslo. Zadejte heslo, které splňuje tyto požadavky.

--Microsoft Knowledge Base Article - 276304

Popelnice Evropy

Počítadlo - Toplist.cz

Copyleft 2005 pok, http://jhutar.ic.cz