[Zope] - newbie PCGI problems
Jeff Bauer
jeffbauer@bigfoot.com
Mon, 7 Dec 1998 20:38:21 -0600
Peter J Ulintz writes:
> My system is a Sun sparc server running Solaris7 and
> Python1.5.1. Installed Apache1.3.3 (first time for me)
> and ran the w_pcgi.py script, which seemed to work correctly.
Congratulations for making it this far along, especially
if you've just started using Apache.
> NEWBIE QUESTION I:
> Exactly where do you put the mod_rewrite config info? I
> tried putting it in the normal three .conf files and got
> errors. I DID compile the server with the mod_rewrite
> included.
The Rewrite directives for Apache normally go in
httpd.conf. Actually the Rewrite directives should only
affect authorization, so if you are denied access *after*
the user name and password dialog appears, everything
else with PCGI is probably working.
> Decided to try out the system anyway, running the
> http://myservername:80/cgi-bin/Zope/manage command and
> got errors (Can't remember the exact one). I checked
> the pcgi.log file, and noticed that I was getting tracebacks
> indicating...
>
> "File
> "/export/home/pulintz/Zope-1.9b1-src/lib/python/BoboPOS/SimpleDB.py",
> line 227, in open
> except: raise IOError, 'could not open ' + file_name
> ImportError: (<class exceptions.IOError at ab3d8>, 'could not open
> /export/home/pulintz/Zope-1.9b1-src/var/Data.bbb.trans')"
>
> So I changed the permissions on the Data.* files /var directory
> (yes the var directory had full permissions), and got the following
> traceback error...
Ah, this points out a potential problem. If you start using
Zope with ZopeHTTPServer under your account, then it's possible
that the database is no longer accessible through your web
server. This is something we should document better, because
it represents a natural progression of tasks.
> File
> "/export/home/pulintz/Zope-1.9b1-src/lib/python/
> Products/sample/Product.py",
> line 24, in ?
> import OFS.SimpleItem, Persistence, Acquisition, AccessControl.Role
> ImportError: (<class exceptions.ImportError at ab540>,
> 'No module named Persistence')
> Went into the Product.py file and changed "Persistence" to
> "BoboPOS.Persistence", and tried to bring up zope in the
> browser again. I got the authentication window! But I
> couldn't authenticate, getting the error message concerning
> the authentication headers.
Okay, you've got the LRP running. As mentioned above, if
you see the authentication window, PCGI's job is essentially
complete. The problem is likely to be your RewriteRule.
Note that you may have to change the path from what's specified
in the INSTALL file. A common error is for users to forget to
specify the absolute pathname.
Changing the code in Product.py is a no-no at this stage
unless you're doing something benign (e.g. log file or
MrCreosote) because you're simply hiding a problem that
will be more difficult to track later. See below.
> Around that time, the email from Jeff Bauer came thru
> indicating that removing the pcgi.* files from the /var
> directory might be good, so I did that, and that's
> all I remember doing at that point. But the next time
> I tried to bring up Zope, I got the "!Temporarily Unavailable"
> message, with the message "(103) unable to verify if
> process is running"
Uh-oh. Did you remember to kill the running LRP? My
earlier advice to Mike P. applied to his condition (not
being able to launch the process). As long as you killed
the running process (if there was one) before removing
the files it's okay. It actually doesn't really matter,
but you don't want stale processes clogging up your system.
> Drag... Guess I've gotta go and read those documents on
> Jeff's site about pcgi. Running the pcgifile.py from the
> /cgi-bin gives...
>
> PCGI info file: /export/home/pulintz/Zope-1.9b1-src/Zope.cgi
> PCGI wrapper: /export/home/pulintz/Zope-1.9b1-src/pcgi/pcgi-wrapper
> error attempting: 'from cgi_module_publisher import publish_module'
> status: FAILURE
This provides us an important clue, although it's slightly
misreported and you actually had it available in your earlier
traceback. (Zope was released before pcgifile.py could be
updated; to be remedied shortly.)
The pcgi_publisher.py module is actually trying to import
publish_module from ZPublisher.
Since your problem (authentication aside) is essentially
one of not being able to import the correct module, for
the time being let's put PYTHONPATH in your Zope.cgi
info file:
PYTHONPATH=/usr/local/bin/python:.
If the solution still isn't obvious, you can try
to expedite things by creating a test cgi file,
TestZope.cgi:
#!/usr/local/bin/python
print "Content-type: text/html"
print
print "Looks OK"
Get TestZope.cgi working and then add some import statements,
placed just before print "Looks OK", e.g.:
from ZPublisher import publish_module
As it breaks, you can add to your import path by iteratively
doing the following, placing the sys.path.append just ahead
of importing publish_module.
import sys
sys.path.append('/export/home/...')
The step above shouldn't be necessary, but it helps to
define a small test case so that you can narrow down the
real problem. And it's better than sitting there staring
at your screen <wink>.
> any advice in the meantime would be appreciated (besides
> "You're not worthy-- go back to Perl")
Worthiness aside, nobody deserves to suffer that fate.
Hang in there,
Jeff Bauer
Rubicon, Inc.