ramkrishanbhatt / modwsgi

Automatically exported from code.google.com/p/modwsgi
0 stars 0 forks source link

mod_wsgi cancot load cx_Oracle #238

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
I can use the oracle with django runserver, 
but when i use apache with mod_wsgi , apache error log : 
ImproperlyConfigured: Error loading cx_Oracle module: DLL load failed: 
What's wrong with it ? 

If I use django runserver, everything goes fine, and I can get the correct 
data. But when I switch the project to apache, it shows: DLL load failed when 
importing cx_Oracle.

Original issue reported on code.google.com by t...@taotao.io on 27 May 2011 at 5:26

GoogleCodeExporter commented 8 years ago
When Python Oracle extension was built it wasn't done so with LD_RUN_PATH set 
in environment so the .so would know were non standard place is that Oracle 
libraries are installed. As a result, you need to manually set LD_LIBRARY_PATH 
for Apache so Apache process nows where they are.

To do this for standard ASF Apache installation you set:

  LD_LIBRARY_PATH=/some/path/to/oracle/libs
  export LD_LIBRARY_PATH

in the 'envvars' file in same directory as Apache htttpd executable.

Some Linux distributions do away with envvars file and you need to do it 
somewhere in init scripts for Apache.

Original comment by Graham.Dumpleton@gmail.com on 27 May 2011 at 5:42

GoogleCodeExporter commented 8 years ago
I'm sorry, after I reset the LD_LIBRARY_PATH, the error still remains:

Exception Type:     ImproperlyConfigured
Exception Value:    Error loading cx_Oracle module: DLL load failed: 
�Ҳ���ָ����ģ�顣

Exception Location: 
    C:\Python27\lib\site-packages\django\db\backends\oracle\base.py in <module>, 
line 46

By the way, my env is: Windows + python 2.7 +Django 1.3

Original comment by bota...@gmail.com on 29 May 2011 at 5:43

GoogleCodeExporter commented 8 years ago
Sorry, didn't read into what you said that you were using Windows.

You are likely falling foul of the problem where within a minor patch revision 
to Python 2.6, Python stopped embedding a reference to VC90.CRT into any 
extension modules built for Python. Instead they expect the program executable, 
usually Python, to have the reference. Problem is that Apache doesn't have the 
reference, so basically the change they made has screwed up many embedded 
systems.

Have a read of:

  http://groups.google.com/group/modwsgi/browse_thread/thread/fa72de2deef276d9

one of the posts in that discussion shows how you can embedded into the Apache 
executable the required reference.

If you are able try that. Alternatively, try binaries at:

  http://www.lfd.uci.edu/~gohlke/pythonlibs/#mod_wsgi

which supposed have mod_wsgi embedded the reference.

A future version of mod_wsgi.so from mod_wsgi site may embed the reference but 
still waiting for someone to tell me how to do that.

Original comment by Graham.Dumpleton@gmail.com on 29 May 2011 at 6:14