[mod_python] Hello newbie problems #2

Kirk Bailey idiot1 at netzero.net
Sat Oct 4 20:17:18 EST 2003


Apache FORKS, spawning new processes- in advance, and has a stable of them on 
hold waiting for incoming requests. When one has handled the number of service 
requests you preset in the conf file, it dies- and is replaced with a new one. 
This uses up a lot of memory with a lot of daemonspawn, and a threading server 
is more memory efficent, although difficult as all hell to write. Python will 
support threading servers if you write one that way. In fact, just to screw with 
your minds, here is one now:
-------------------------------BEWARE WORD WRAP-----------------------------
#!C:\Python22\Pythonw.exe
from SocketServer import ThreadingMixIn
import BaseHTTPServer, CGIHTTPServer, os
#
os.chdir ('.\web')	# INSTALL IN c:\Python22; web pages in ~\web
#
class ThreadingCGIServer(ThreadingMixIn,BaseHTTPServer.HTTPServer):
	pass
import sys
server=ThreadingCGIServer(('',8080),CGIHTTPServer.CGIHTTPRequestHandler)
try:
	while 1:
		sys.stdout.flush()
		server.handle_request()
except KeyboardInterrupt:
	print 'Finished.'
---------------------------END OF SCRIPT, CHAOS FOLLOWS------------------
This is by Steve Holden of the book 'Cgi programming for the Internet'.



Gregory (Grisha) Trubetskoy wrote:

> This oftentimes means that either of Apache or Python was compiled without
> thread support, and therefore you need to make sure that both are with or
> without threads.
> 
> Which operating system is this on?
> 
> Grisha
> 
> On Fri, 3 Oct 2003, M.D. DeWar wrote:
> 
> 
>>The below link got mod_python to compile and install.
>>However when I put the info into the httpd.conf I get this error:
>>
>>Syntax error on line 262 of /usr/local/apache2/conf/httpd.conf:
>>Cannot load /usr/local/apache2/modules/mod_python.so into server:
>>/usr/local/apa
>>che2/modules/mod_python.so: Undefined symbol "pthread_self"
>>
>>At the bottom of the link provided I see that I should or thought I should
>>configure with these options:
>>spiderman#
>>./configure --with-python=/usr/local/bin/python --with-apxs=/usr/local/apach
>>e2/bin/apxs
>>
>>(I tried the --with-python=  being blank but system sat there and with
>>/usr/local/bin/ just gave an error.)
>>
>>I could not find more info on this error.
>>Thanks
>>mark
>>
>>----- Original Message -----
>>From: "Gregory (Grisha) Trubetskoy" <grisha at modpython.org>
>>To: "M.D. DeWar" <mark at s-wit.net>
>>Cc: <mod_python at modpython.org>
>>Sent: Friday, October 03, 2003 3:16 PM
>>Subject: Re: [mod_python] Hello newbie problems
>>
>>
>>
>>>Check this out:
>>>
>>>http://www.modpython.org/FAQ/faqw.py?req=all#4.2
>>>
>>>On Fri, 3 Oct 2003, M.D. DeWar wrote:
>>>
>>>
>>>>Hello,
>>>>I installed python 2.3.1 (or whatever is the latest from the site)
>>>>I d/l the mod_python 3.03
>>>>I have apache 2.0.47 running.
>>>>I did as per each README for each isntall.
>>>>Apache is running. python seemed to install ok. There were no errors.
>>>>I ./configured --with-apxs=/usr/local/apache2/bin/apxs for mod_python.
>>>>That seemed okay.
>>>>make gives me this error: google search brought up nothing on it. (last
>>
>>2
>>
>>>>lines).
>>>>I did the ./httpd -DONE_PROCESS also.
>>>>
>>>>python2.3  -c -o requestobject.lo requestobject.c && touch
>>
>>requestobject.slo
>>
>>>>requestobject.c: In function `getreq_recmbr_off':
>>>>requestobject.c:1055: `LONG_LONG' undeclared (first use in this
>>
>>function)
>>
>>>>requestobject.c:1055: (Each undeclared identifier is reported only once
>>>>requestobject.c:1055: for each function it appears in.)
>>>>requestobject.c:1056: syntax error before `l'
>>>>requestobject.c:1057: `l' undeclared (first use in this function)
>>>>requestobject.c: At top level:
>>>>requestobject.c:1270: warning: initialization from incompatible pointer
>>
>>type
>>
>>>>apxs:Error: Command failed with rc=65536
>>>>.
>>>>*** Error code 1
>>>>
>>>>Stop in /temp/mod_python-3.0.3/src.
>>>>*** Error code 1
>>>>Mark DeWar
>>>>
>>>>_______________________________________________
>>>>Mod_python mailing list
>>>>Mod_python at modpython.org
>>>>http://mailman.modpython.org/mailman/listinfo/mod_python
>>>>
>>
>>_______________________________________________
>>Mod_python mailing list
>>Mod_python at modpython.org
>>http://mailman.modpython.org/mailman/listinfo/mod_python
>>
> 
> _______________________________________________
> Mod_python mailing list
> Mod_python at modpython.org
> http://mailman.modpython.org/mailman/listinfo/mod_python
> 
> 

-- 

-- 

end

Cheers!
         Kirk D Bailey

  +                              think                                +
   http://www.howlermonkey.net  +-----+        http://www.tinylist.org
   http://www.listville.net     | BOX |  http://www.sacredelectron.org
   Thou art free"-ERIS          +-----+     'Got a light?'-Prometheus
  +                              kniht                                +

Fnord.



More information about the Mod_python mailing list