Actually, you generally want everything to be 64 bit and not 32 bit if you can.
> So, now, I want to deploy this into the Apache 2 server running on my
> mac, to test out some more dependencies, before moving the whole lot
> over to our production Linux machine (where, happily, these problems I
> am now having will go away -- but I need to test things on this
> machine first). So first thing to do was recompile Apache 2 in 32
> bit, and get that started as the default webserver in my local
> machine, including the mod_wsgi.so also compiled to 32 bits.
How are you ensuring that Apache was compile ONLY as 32 bit and not a
full fat binary. The compiler by default will make it fat and if you
have 64 bit capable CPU and its is fat binary, MacOSX will run it as
64 bit and not 32 bit.
Please confirm whether you are using Apple supplied Apache or your own
compiled Apache. Provide the output of running the file command on it,
showing the full path to where Apache httpd binary is installed that
you are using. For example, if using Apache supplied by Apple you
would see.
$ file /usr/sbin/httpd
/usr/sbin/httpd: Mach-O universal binary with 3 architectures
/usr/sbin/httpd (for architecture x86_64): Mach-O 64-bit executable x86_64
/usr/sbin/httpd (for architecture i386): Mach-O executable i386
/usr/sbin/httpd (for architecture ppc7400): Mach-O executable ppc
Also go into the Activity Monitor application for MacOS X and look at
the Kind column for Apache and see whether it says 'Intel' or 'Intel
(64 bit)'.
> So now the fun starts. When I have apache call the mod_wsgi handler
> (which I am using to run a django user authentication etc module) I
> get errors which I do NOT get when runing the same application in the
> development server.
>
> First error: from the apache error log --
> [Fri Mar 18 08:14:05 2011] [error] [client 192.168.1.100] mod_wsgi
> (pid=9128): Exception occurred processing WSGI script '/Peter stuff/
> SDE/subscribers/django access control/anaaccess/apache/django.wsgi'.
> [Fri Mar 18 08:14:05 2011] [error] [client 192.168.1.100] Traceback
> (most recent call last):
> [Fri Mar 18 08:14:05 2011] [error] [client 192.168.1.100] File "/
> Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-
> packages/django/core/handlers/wsgi.py", line 230, in __call__
> [Fri Mar 18 08:14:05 2011] [error] [client 192.168.1.100]
> self.load_middleware()
> [Fri Mar 18 08:14:05 2011] [error] [client 192.168.1.100] File "/
> Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-
> packages/django/core/handlers/base.py", line 42, in load_middleware
> [Fri Mar 18 08:14:05 2011] [error] [client 192.168.1.100] raise
> exceptions.ImproperlyConfigured, 'Error importing middleware %s: "%s"'
> % (mw_module, e)
> [Fri Mar 18 08:14:05 2011] [error] [client 192.168.1.100]
> ImproperlyConfigured: Error importing middleware request.middleware:
> "No module named request.middleware"
That is a problem with how you have set sys.path in WSGI script file
or a permissions problem where by user that Apache runs as can't read
the location where package is installed. What is the contents of your
WSGI script file? What are all the permissions on the package
directory and the parent directory of it.
What do you get for:
file /usr/local/python-eggs/MySQL_python-1.2.3-py2.6-macosx-10.3-fat.egg-tmp/_mysql.so
What do you get for:
otool -L /usr/local/python-eggs/MySQL_python-1.2.3-py2.6-macosx-10.3-fat.egg-tmp/_mysql.so
and:
DYLD_LIBRARY_PATH="" otool -L
/usr/local/python-eggs/MySQL_python-1.2.3-py2.6-macosx-10.3-fat.egg-tmp/_mysql.so
For the libmysqlclient.16.dylib it finds, what do you get for:
file .....somepath/libmysqlclient.16.dylib
> Ok, the main one at the bottom seems to be that it cannot find the
> libmysqlclient.16.dylib needed by the 32 bit mysql application.
Not necessarily. Believe that can mean that the a .so or dynamic
library doesn't include required architecture.
> I had
> this when compiling for the development version, and fixed it by
> adding export DYLD_LIBRARY_PATH=/usr/local/mysql/lib/ to my bash
> profile. But this seems to be ignored by mod_wsgi. Adding this to
> the django.wsgi file
> os.environ['DYLD_LIBRARY_PATH'] = '/usr/local/mysql/lib'
> also does not work.
Normally Apache is started as root and so it will not inherit stuff in
your personal account setup. Setting it in the WSGI script file is too
late as has to be set before process starts.
The checks I told you to run above should show what is what and where
things are being found or not. Once can see that can suggest best way
of solving problem.
Graham