31 okt 2008 kl. 04.23 skrev Graham Dumpleton: > > > > On Oct 31, 10:14 am, Håkan Waara <[EMAIL PROTECTED]> wrote: >> Hi folks, >> >> I'm in the process of for the first time deploying a django site that >> (unfortunately) needs to share its Apache with an existing PHP site. >> >> I've been reading a bunch about mod_wsgi and in many places there are >> mentions that setting up apache with mpm-worker (basically >> multithreaded mode) will not work if you're also hosting a PHP site >> on >> the same Apache; Apache will crash, and the world will collapse... >> >> What I haven't been able to find out is if it's possible/worth it to >> use mod_wsgi (efficiently) in this situation at all, and if so how to >> do it? >> >> Does anyone have other suggestions on how to avoid mod_python in this >> situation? Should I have a look at nginx for example? >> >> Any hints appreciated! > > It is not necessary to be running Apache worker MPM to run mod_wsgi, > it will work quite happily in Apache prefork MPM, just like mod_python > can. Also note that if you have problems with mod_wsgi, using > mod_python will not help as it can be impacted by exactly the same > problems. > > Now, which MPM you use is not the problem you seem to think it is. The > real problem is generally going to be mismatches in what versions of > shared libraries that PHP uses compared to what various Python modules > require. The main culprit for this is MySQL as PHP generally uses a > non reentrant variant of MySQL client libraries where as Python MySQL > module generally uses a reentrant variant of the library. Result of > this can be Apache crashing. > > Other problems can also arise if you are using Debian and the broken > Python 2.4 that Debian released. Specifically, Debian folks fiddled > with the hash module code in Python 2.4 and caused a conflict between > it and a hash module in PHP. This can cause problems with session IDs > being generated incorrectly and causing session mechanisms to fail, or > could also crash Apache. > > These issues and others can be found described in: > > http://code.google.com/p/modwsgi/wiki/ApplicationIssues > > Now, although mod_wsgi can be used with Apache prefork MPM and you can > run your Django application in embedded mode, because prefork means > more Apache child processes, you might not find it desirable that your > fat Django application then causes Apache as a whole to use up so much > memory. In this situation, don't run your Django in mod_wsgi embedded > mode, instead create a mod_wsgi daemon mode process groups and > delegate Django to run in that instead. Use one multithreaded daemon > mode process, or if your Django application isn't thread safe, a small > number of single threaded processes. > > For some quick examples of embedded versus daemon mode configuration > see: > > http://code.google.com/p/modwsgi/wiki/QuickConfigurationGuide > > You should also go through other documentation on the mod_wsgi site > properly as well though. Don't assume that just reading one page, or > some ones blog on how they did it, or relying on answers to questions > you get from irc channels is going to be sufficient. This is why the > documentation exists.
Thank you for this extremely informative post, Graham! Your heads up on the hash issue was also most appreciated -- it's very likely I'd run into it otherwise, because I'm running python2.4 on debian (etch). I might as well have to update to a newer Python version. /Håkan --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---

