Your comment on

Name: 

Notify email: 

Comment:

  
       

home :: Dokumente :: MacOSX :: Leopard :: ApacheModules :: python_module.html

Montag, 21 April 2008


mod_python on leopard

Tagged as: , ,

mod_python on Leopard

Compiling mod_python on Leopard is not as simple as it would appear. The default install only builds a i386 version that fails when restarting Apache with the error:

httpd: Syntax error on line ** of /Users/*******/Downloads/mod_python-3.3.1/test/conf/test.conf: Cannot load /usr/libexec/apache2/mod_python.so into server: dlopen(/usr/libexec/apache2/mod_python.so, 10): no suitable image found. Did find:\n\t/usr/libexec/apache2/mod_python.so: mach-o, but wrong architecture



my own rundown is:

downloaded mod_python:

wget http://www.apache.org/dist/httpd/modpython/mod_python-3.3.1.tgz

unstuff:

tar -xzf mod_python-3.3.1.tgz
cd mod_python-3.3.1

configure with apxs (actually I think a simple ./configure would also do)

./configure --with-apxs=/usr/sbin/apxs

now patch src/MakeFile:



  • Add -arch x86_64 -arch ppc -arch i386 to the end of the LDFLAGS line (no quotes, of course).
  • <
  • Add -arch x86_64 -arch ppc -arch i386 to the end of the CFLAGS line , otherwise you‰Ä™ll get the "symbol not found" error.
  • Under the mod_python.so target add the following to the line after the -c but before the -Wc,"-arch x86_64" -Wc,"-arch ppc" -Wc,"-arch i386" so the complete line looks like. -c -Wc,"-arch x86_64" -Wc,"-arch ppc" -Wc,"-arch i386"

and now:

make && sudo make install

now edit your apache config file (sudo nano /etc/apache2/httpd.conf) in order to load mod_python add (or uncomment) the following line:

LoadModule python_module libexec/apache2/mod_python.so

In order to test whether mod_python works add the following to your apache config:


<Location /mpinfo>
  SetHandler mod_python
  PythonInterpreter main_interpreter
  PythonHandler mod_python.testhandler
</Location>


restart the apache webserver (sudo apachectl graceful) and point your browser to localhost/mpinfo

That should give you a page with the mod_python configuration info

You can check the architecture of your mod_python module in the terminal with:

file /usr/libexec/apache2/mod_python.so

It should return the following result:

/usr/libexec/apache2/mod_python.so: Mach-O universal binary with 3 architectures
/usr/libexec/apache2/mod_python.so (for architecture x86_64):	Mach-O 64-bit bundle x86_64
/usr/libexec/apache2/mod_python.so (for architecture ppc7400):	Mach-O bundle ppc
/usr/libexec/apache2/mod_python.so (for architecture i386):	Mach-O bundle i386

Comments:

Thursday, 29.November 2007 22:47:11 Nicolas wrote:

for that works, my line under the mod_python.so target looks like to $(APXS) $(INCLUDES) -c -Wc,"-arch x86_64" -Wc,"-arch ppc" -Wc,"-arch i386" $(SRCS) $(LDFLAGS) $(LIBS)

Add comment | /Dokumente/MacOSX/Leopard/ApacheModules | permanent link



Farbflash trac projects

Search

Tag cloud

Category
Show articles per page

RSS Feed

Links
  • 3DPI
    - Property Inspector to edit and explore all properties of a director #shockwave3d member. Without the 3DPI the whole 3-D stuff would be nearly undoable!
  • ULLALA
    Excellent examples and tutorials
  • DOUG
    Director online -- First place to look for Director related info
  • JAMES NEWTON
    another bunch of excellent demos and source code
  • MEKKA MEDIALIGHT LINGOWORKSHOP
    lots of excellent demos and source code from Luke Wigley
  • VALENTIN SCHMIDT
    lots of excellent xtras and source code. Home of the indispensable Shell Xtra!
  • XONKO
    Mark Hills site. Very good tutorials and other director and 3-D related stuff
  • INLUDO
    Barry Swans director demos and tutorials
  • Deans Director resources
    Dean Utians huge collection of resources and tutorials related to everything Director
  • THE HENDRIK DORGATHEN SITE
    not at all related to director, but one of my favorite graphic design art sites
  • SALINAS
    the site, of our local resistance against nuclear garbage (german)
  • TIMKID
    furniture for children (with some shockwave3d pieces)

Contact

Disclaimer

Donate
If one of the open source examples on this page helped you to get a paid job delivered, you might want to contribute and support my work by donating via PayPal...

Private
Login:
Passwort:

  
design and code by Alex da Franca