Mod_ruby breaks php

I'm having a very odd problem. My software:

     Apache 2.0.53
     PHP 4.3.10
     mod_ruby 1.2.4

(I'm just now upgrading PHP to 4.3.11 to test again.)

It seems that if I run a script using mod_ruby, php mysteriously starts
breaking. I'm not sure at the moment where or how, but my web tests
(which set up a server, send HTTP requests to it, and examine the
results) all run fine if I don't run any ruby scripts; even running an
empty one will cause PHP code to start failing.

I'm going to see if I can come up with a repeatable test case for this,
but in the meantime, has anybody else ever seen anything like this? Are
there any mod_ruby gurus out there who could help me out with this?

cjs

···

--
Curt Sampson <cjs@cynic.net> +81 90 7737 2974 http://www.NetBSD.org
      Make up enjoying your city life...produced by BIC CAMERA

A little more information on this problem:

The tests that are failing are failing in a consistent way, and I wonder
if it's related to the PostgreSQL drivers. The tests all submit a
request to register a new user in my system. The PHP code first attempts
to select a user with that name out of the database and, if the nothing
is returned, then does the appropriate inserts, etc. When working
properly (i.e., when I have executed no ruby code), the select returns
nothing. When not working properly, the select (very mysteriously!)
returns the user! I've turned on statement logging, and no inserts are
executed. Also, a completely separate program readinng the database does
not see that row.

This is very strange.

cjs

···

--
Curt Sampson <cjs@cynic.net> +81 90 7737 2974 http://www.NetBSD.org
      Make up enjoying your city life...produced by BIC CAMERA

On Fri, 1 Apr 2005, Curt Sampson wrote:

I'm having a very odd problem. My software:

   Apache 2.0.53
   PHP 4.3.10
   mod_ruby 1.2.4

(I'm just now upgrading PHP to 4.3.11 to test again.)

It seems that if I run a script using mod_ruby, php mysteriously starts
breaking. I'm not sure at the moment where or how, but my web tests
(which set up a server, send HTTP requests to it, and examine the
results) all run fine if I don't run any ruby scripts; even running an
empty one will cause PHP code to start failing.

I'm going to see if I can come up with a repeatable test case for this,
but in the meantime, has anybody else ever seen anything like this? Are
there any mod_ruby gurus out there who could help me out with this?

cjs

Well, if anybody's curious, the reason that my PHP code broke after
running a mod_ruby script is that PHP doesn't touch the environment,
but mod_ruby replaces the environment with what would be provided to a
CGI script. My PHP stuff for getting a database connection relied on an
environment variable to supply the schema name, and so after running a
ruby script during testing, it would in the future connect to the wrong
database schema, giving me bogus information.

Adding a SetEnv directive to my http config ensured that the variable
is passed. However, it's arguably a bug that mod_ruby does not restore
the environment when it's finished processing a request, so that other
modules see apache's original environment rather than mod_ruby's
modified one.

cjs

···

--
Curt Sampson <cjs@cynic.net> +81 90 7737 2974 http://www.NetBSD.org
      Make up enjoying your city life...produced by BIC CAMERA