architekt1024 / modwsgi

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

mod_wsgi cannot connect load python binding with mysql #234

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
First I will list my environment and status:

Environment:

System: Mac OS 10.6
Python: 2.6
Apache: 2.2
mod_wsgi: 3.3
mysql: 5.x
php: 3.5
trac:0.12
Status: I can run trac as alone-server without problem. Now I integrate trac to 
apache, problem come out. mod_wsgi can run normal wsgi page correctly, but 
cannot load mysql connection. I test it in piece of code, put "import MySQLdb" 
in wsgi page, it still cannot. I also can access trac through apache, but it 
shows me Cannot load Python bindings for MySQL

I refer to the apache log:

[Sun Mar 13 13:36:44 2011] [error] [client ::1] mod_wsgi (pid=37060): Target 
WSGI script /Users/alex/Library/apache2/htdocs/sql.wsgi' cannot be loaded as 
Python module.

[Sun Mar 13 13:36:44 2011] [error] [client ::1] mod_wsgi (pid=37060): Exception 
occurred processing WSGI script '/Users/alex/Library/apache2/htdocs/sql.wsgi'.

[Sun Mar 13 13:36:44 2011] [error] [client ::1] Traceback (most recent call 
last):

[Sun Mar 13 13:36:44 2011] [error] [client ::1]   File 
"/Users/alex/Library/apache2/htdocs/sql.wsgi", line 2, in <module>

[Sun Mar 13 13:36:44 2011] [error] [client ::1]     import MySQLdb

[Sun Mar 13 13:36:44 2011] [error] [client ::1]   File 
"build/bdist.macosx-10.6-universal/egg/MySQLdb/__init__.py", line 19, in 
<module>

[Sun Mar 13 13:36:44 2011] [error] [client ::1]   File 
"build/bdist.macosx-10.6-universal/egg/_mysql.py", line 7, in <module>

[Sun Mar 13 13:36:44 2011] [error] [client ::1]   File 
"build/bdist.macosx-10.6-universal/egg/_mysql.py", line 6, in __bootstrap__

[Sun Mar 13 13:36:44 2011] [error] [client ::1] ImportError: 
dlopen(/Users/alex/.python-eggs/MySQL_python-1.2.3-py2.6-macosx-10.6-universal.e
gg-tmp/_mysql.so, 2): Library not loaded: libmysqlclient.16.dylib

[Sun Mar 13 13:36:44 2011] [error] [client ::1]   Referenced from: 
/Users/alex/.python-eggs/MySQL_python-1.2.3-py2.6-macosx-10.6-universal.egg-tmp/
_mysql.so

[Sun Mar 13 13:36:44 2011] [error] [client ::1]   Reason: image not found

[Sun Mar 13 13:36:57 2011] [error] [client ::1] mod_wsgi (pid=37061): Target 
WSGI script

This looks like mod_wsgi cannot find libmysqlclient.16.dylib. I encounter 
similar problem when I install mysqldb for python, so I add export

DYLD_LIBRARY_PATH=/Users/alex/Library/mysql-5.x/lib

SO python -c "import MySQLdb" can work, but mod_wsgi cannot work. So I put

os.environ['DYLD_LIBRARY_PATH'] = '/Users/alex/Library/mysql-5.x/lib'
into trac.ini. It doesn't work for trac in apache still.

So anyone has this problem before? Thanks

I use 'file' checked all my apache , mysql is 64-bit compiled.

Original issue reported on code.google.com by alex....@gmail.com on 18 Mar 2011 at 3:28

GoogleCodeExporter commented 8 years ago
Any through instruction on setting up on Mac?

Original comment by alex....@gmail.com on 18 Mar 2011 at 3:33

GoogleCodeExporter commented 8 years ago
See discussion on mailing list at:

  https://groups.google.com/d/topic/modwsgi/aNSeRUiF1OY/discussion

and do the same things to confirm status of installation and followup to that 
discussion rather than here.

Ie., easier to solve it in the one place as your aren't alone. This presumes 
you aren't the same person masquerading under different identities.

Original comment by Graham.Dumpleton@gmail.com on 18 Mar 2011 at 4:42

GoogleCodeExporter commented 8 years ago
CLosing as as far as can tell this is all an issue to do with more recent 
builds of MySQL libraries and not mod_wsgi.

Original comment by Graham.Dumpleton@gmail.com on 19 Mar 2012 at 10:41