logo
Apache Lounge
Webmasters

 

About Forum Index Downloads Search Register Log in RSS X


Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.

or

Bitcoin

A donation makes a contribution towards the costs, the time and effort that's going in this site and building.

Thank You! Steffen

Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
Post new topic   Forum Index -> Apache View previous topic :: View next topic
Reply to topic   Topic: Setup Apache and fastcgi for python on Windows
Author
William87



Joined: 09 May 2009
Posts: 1

PostPosted: Sat 09 May '09 10:32    Post subject: Setup Apache and fastcgi for python on Windows Reply with quote

Is there a clear single-webpage guide on how to setup fcgid on Apache on Windows? I'm not very well-versed in the Linux vocabulary, and the available references on the net are Linux-intensive.
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7288
Location: Germany, Next to Hamburg

PostPosted: Sat 09 May '09 11:07    Post subject: Reply with quote

I haven't tested it, cause I don't use python. But this could work.

Code:

LoadModule fcgid_module modules/mod_fcgid.so
<IfModule mod_fcgid.c>
   IPCCommTimeout 40
   IPCConnectTimeout 10
   MaxProcessCount 8
   OutputBufferSize 64
   ProcessLifeTime 60
   MaxRequestsPerProcess 500
   DefaultMinClassProcessCount 0
</IfModule>



NameVirtualHost *:80

<VirtualHost *:80>
    DocumentRoot c:/server2/www_fcgi
    ServerName fcgi.local
    ErrorLog c:/server2/logs/fcgi.error.log
    CustomLog c:/server2/logs/fcgi.access.log common
  <Directory "c:/server2/www_fcgi">
    AddHandler fcgid-script .py
     Options Indexes FollowSymLinks ExecCGI
     FCGIWrapper "c:/Python/python.exe -u" .py
    AllowOverride All
    Order allow,deny
    Allow from all
  </Directory>
</VirtualHost>


Note the -u following the interpreter path; this is very important. It puts the python interpreter in "unbuffered" mode. Trying to run python cgi scripts in the (default) buffered mode will either result in a complete lack of return value from your cgi script (manifesting as a blank html page) or a "premature end of script headers" error.

maybe it is better to use SetEnv PYTHONUNBUFFERED 1 in httpd.conf instead of -u parameter.

Give it a try Wink please tell me if that works
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7288
Location: Germany, Next to Hamburg

PostPosted: Mon 14 Dec '20 10:23    Post subject: Reply with quote

Just for the record. It does not run with mod_fcgid.
Back to top


Reply to topic   Topic: Setup Apache and fastcgi for python on Windows View previous topic :: View next topic
Post new topic   Forum Index -> Apache