[Zope] zope.cgi file under NT installation?

Duncan Booth duncan@rcp.co.uk
Thu, 30 Sep 1999 12:35:43 +0000


> I'm trying to get the ZServer (and Zope) to run behind IIS on NT 4.0.  The
> How-To's, list messages, and readme's refer to modifying the zope.cgi
> file. Unfortunately, I've got an NT installation of Zope that I installed
> direct from precompiled binaries, and I can't find a zope.cgi file
> anywhere.
> 
> I've seen some examples of zope.cgi posted on the list, but these were all
> for linux installations.  Does anybody have an example zope.cgi from an NT
> installation, and that is intended to run behind IIS, not Apache?  Or,
> barring that, would anyone be willing to help make suggestions on
> modifying an existing zope.cgi file from a linux installation.  Most of
> the paths are obvious to change, but I can't, for instance, find the
> pcgi.soc, pcgi.pid, or pcgi.log files.  One example I have is this one:
> 

I have Zope running using pcgi behind a Netscape Enterprise server 
on NT. The configuration may not be exactly what you want, but it 
may help somewhat. A lot of what I did to get this working was based 
on the IIS instructions, and it does actually work (honest).
My zope installation on the server is in the directory H:\Zope.

File Zope.pcgi:
#!H:/cgi-bin/pcgi-wrapper.exe
PCGI_NAME=Zope
PCGI_MODULE_PATH=H:/Zope/lib/python/Zope
PCGI_PUBLISHER=H:/Zope/pcgi/pcgi_publisher.py
PCGI_EXE=H:/Zope/bin/python.exe
PCGI_SOCKET_FILE=H:/Zope/var/pcgi.soc
PCGI_PID_FILE=H:/Zope/var/z2.pid
PCGI_ERROR_LOG=H:/Zope/var/pcgi.log
PCGI_DISPLAY_ERRORS=1
INSTANCE_HOME=H:/Zope
PCGI_PORT=9079

I don't use the file associations as suggested for the IIS 
configuration. Instead I created a file zope.bat:
@h:\cgi-bin\pcgi-wrapper h:\cgi-bin\zope.pcgi

I had to make a couple of small changes to pcgi-wrapper and 
recompile it (these may not be needed for IIS):
File pcgi.h:
Change:
#ifdef WIN32
#include <windows.h>
#include <io.h>
#include <iostream.h>
#include <winsock.h>
#endif

to:
#ifdef WIN32
#include <windows.h>
#include <io.h>
#include <iostream.h>
#include <winsock.h>
#include <fcntl.h>
#endif

And in pcgi-wrapper.c add the following lines just after the #ifdef 
CLOSE_FDS...#endif

#ifdef WIN32
    _setmode(fileno(stdin), O_BINARY);
    _setmode(fileno(stdout), O_BINARY);
#endif

Without these changes to force stdio into binary mode, I was able to 
get it working on HTML documents but GIF files were corrupted.


-- 
Duncan Booth                                             duncan@dales.rmplc.co.uk
int month(char *p){return(124864/((p[0]+p[1]-p[2]&0x1f)+1)%12)["\5\x8\3"
"\6\7\xb\1\x9\xa\2\0\4"];} // Who said my code was obscure?
http://dales.rmplc.co.uk/Duncan