
Hi, I had a change I made to twcgi ages ago which I've just recently revised: Old Issue: http://www.twistedmatrix.com/users/roundup.twistd/twisted/issue516 New Patch: --------------------------------------------------------------------------- --- twisted/web/twcgi.py (revision 10536) +++ twisted/web/twcgi.py (working copy) @@ -154,11 +154,20 @@ class PHPScript(FilteredScript): """I am a FilteredScript that uses the PHP command on most systems. Sometimes, php wants the path to itself as argv[0]. This is that time. + + To run as cgi, I require the following configuration options in php.ini be set: + cgi.fix_pathinfo = 1 + cgi.force_redirect = 0 """ filter = '/usr/bin/php4' +class DebianPHPScript(PHPScript): + """PHP binary is in a different place in Debian""" + filter = '/usr/lib/cgi-bin/php4' + + class CGIProcessProtocol(protocol.ProcessProtocol, pb.Viewable): handling_headers = 1 headers_written = 0 --------------------------------------------------------------------------- The doc changes are required imho, but I don't really like the subclass for Debian. Frankly, I think it sucks, but can anyone see a cleaner way of doing this? It almost feels like something that should be configured on runtime - there are too many places the php4 variable could be (and we can't exactly do a $PATH lookup, becuase php4-cli doesn't have all the cgi stuff in it, and is in /usr/bin/php4 under debian systems). Regards, Stephen Thorne

Stephen Thorne [Wed, Apr 14, 2004 at 12:20:46AM +1000]:
The doc changes are required imho,
Using twcgi.py + PHP, I've had problems with setcookie in PHP (eg. session_start() set the session cookie okay, but correct, working-in-apache setcookie calls wasn't passed to Twisted Web when run as CGI). Do those changes in php.ini get rid of such problems?
but I don't really like the subclass for Debian. Frankly, I think it sucks, but can anyone see a cleaner way of doing this?
Get a list of common prefixes (/usr, /usr/local, /usr/pkg, /opt), combine with a list of common locations (lib/cgi-bin/php, libexec/cgi-bin/php, bin/php) ... should do. NetBSD: /usr/pkg/libexec/cgi-bin/php FreeBSD: /usr/local/bin/php (probably) -- Michal Pasternak :: http://pasternak.w.lub.pl :: http://winsrc.sf.net Here's my obfuscated Python signature code, to indicate I'm a Python guy:
print u'micha\u0142 pasternak'.encode("iso8859-2")
participants (2)
-
Michal Pasternak
-
Stephen Thorne