2
votes

I make mod_wsgi is like following

$./configure --with-python=/Library/Frameworks/Python.framework/Versions/2.7/bin/python --with-apxs=/usr/local/apache2/bin/apxs

checking Apache version... 2.0.63

configure: creating ./config.status

config.status: creating Makefile

$sudo make $sudo make install

and then I copy file from /usr/local/apache2/modules/mod_wsgi.so to /Applications/MAMP/Library/modules/mod_wsgi.so

And then I add

LoadModule wsgi_module modules/mod_wsgi.so

in httpd.conf

I run the apache and I got error.

$ sudo /Applications/MAMP/Library/bin/apachectl start

Syntax error on line 287 of /Applications/MAMP/conf/apache/httpd.conf: Cannot load /Applications/MAMP/Library/modules/mod_wsgi.so into server: cannot create object file image or add library

1
Supply what CONFIG_ARGS is set to in '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/config/Makefile'. Also supply output from 'otool -L /Applications/MAMP/Library/modules/mod_wsgi.so'.Graham Dumpleton
BTW, why are you using MAMP in the first place when Apache supplied by MacOS X is so much newer and not the ancient MAMP version? Part of your problems may be that you are compiling against an Apache installation different to which module is then being used with. Yes MAMP may not supply source code and you are forced to try and do that, but sounds like a recipe for problems.Graham Dumpleton
$otool -L /Applications/MAMP/Library/modules/mod_wsgi.so /Applications/MAMP/Library/modules/mod_wsgi.so: /Library/Frameworks/Python.framework/Versions/2.7/Python (compatibility version 2.7.0, current version 2.7.0) /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 125.2.0) /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 550.29.0) What is CONFIG_ARFS ??saturngod
CONFIG_ARGS is a variable inside the Makefile at location '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/config/Makefile'. It shows what configure options were used when the Python installation was built. The Python dmg installers from Python web site have in the past not been built always in a way that will work for embedded systems on MacOS X. The purpose of seeing the args is to see if it may this time. You don't need to install Apache 2.2 on your machine because Apple ships one by default with it. Run '/usr/sbin/httpd -V' to see version.Graham Dumpleton

1 Answers

0
votes

Step 1: Make sure your version of MAMP is Version 2 because it includes a Universal Binary installer (32-bit & 64-bit)

Step 2: Modify your Make file and eliminate the other compiler versions, similar to:

CPPFLAGS = -I/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -DNDEBUG 
CFLAGS = -Wc,"-arch i386" -Wc,"-arch x86_64" -Wc
LDFLAGS = -arch i386 -arch x86_64 -F/Library/Frameworks -framework Python -u _PyMac_Error 
LDLIBS = -ldl  -framework CoreFoundation

Step 3: In httpd.conf: LoadModule wsgi_module modules/mod_wsgi.so