[mod_python] PythonInterpPerDirec* Question

Huzaifa Tapal huzaifa at hostway.com
Mon Sep 12 16:04:59 EDT 2005

Thanks for the info Graham.  I had definitely made sure that I was 
getting into the Directory directive, however, the 
PythonInterpPerDirective was not bein honored. 

As for the bugs with the PythonInterpPerDirective directive, I see in 
the comments that the problem outlined have been patched.  Is there a 
way to get that patch to be applied to my current version of mod_python?


Graham Dumpleton wrote:

> On 09/09/2005, at 7:46 AM, Huzaifa Tapal wrote:
>>  Hello all,
>>  I have a question about the usage of the PythonInterpPerDirectory 
>> and PythonInterpPerDirective directives.  I am trying to setup a 
>> development box with mod_python support, and want to set it up in a 
>> way so that different users, within their cgi-bin can have multiple 
>> mod_python handler installations and each handler having its own set 
>> of sub-interpreters.  After doing some research I found that the 
>> usage of the above two directives is the solutions (or maybe 
>> something else that I am not aware of).
>>  I am trying to set the above directive in my httpd.conf file as 
>> follows:
>>  <Directory /home/*/www/cgi-bin/>
>>         PythonInterpPerDirective On       # or 
>> PythonInterpPerDirectory On
>>  </Directory>
> You can check whether this is even coming into play by including:
>   deny from all
> If the path pattern is right, you should then get Forbidden.
>>  now I test this by creating two directories within a user's cgi-bin 
>> say /home/user/www/cgi-bin/handler1 and 
>> /home/user/www/cgi-bin/handler2 and add a handler module and a 
>> .htaccess file with the following contents:
>> SetHandler mod_python
>>  PythonHandler mptest
>>  PythonDebug On
>>  Within the handlers, I am creating a cache dictionary at global 
>> level and testing the cache for that dictionary by printing its 
>> values and also printing the id of the cache dictionary.  When 
>> executing both handlers, it appears that both handlers in both 
>> directories are sharing the subinterpreters when they should not be.
> I wouldn't necessarily rely on using Python id() as basis to determine
> if they are same/different interpreter.
> For starters, simply display value of "req.interpreter". This will be
> the name given to each interpreter. It should equate somehow to the path
> to the physical directory.
> Note that there are some bugs in the PythonInterpPerDirectory directive.
> See:
>   http://issues.apache.org/jira/browse/MODPYTHON-5
> This is address in mod_python 3.2 beta versions.
> Graham

More information about the Mod_python mailing list