You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by "George L. Roman" <gr...@arionsys.com> on 2007/11/13 03:54:15 UTC

+Parent breaks Oracle connection?

I'm having trouble running RT using the

        PerlOptions +Parent

directive.

My httpd.conf file:

  NameVirtualHost *

  <VirtualHost *>
    ServerName          default.name.com
    DocumentRoot        "/var/www/html"
    <Directory          "/var/www/html">
        Options                 FollowSymLinks
        AllowOverride           None
        Order                   allow,deny
        Allow                   from all
    </Directory>
  </VirtualHost>

  <VirtualHost *>
    ServerName          rt.name.com
    DocumentRoot        "/opt/rt3/share/html"
    AddDefaultCharset   UTF-8

    ErrorLog            logs/error_log_rt
    CustomLog           logs/access_log_rt combined

    # This PerlOptions line causes DB connect failure
    #PerlOptions +Parent

    PerlRequire /opt/rt3/bin/webmux.pl

    <Location />
        SetHandler      perl-script
        PerlHandler     RT::Mason
    </Location>
  </VirtualHost>

This config file works great.  I can surf to rt (port 80) and login to
RT.

When I uncomment the

    PerlOptions +Parent

line, however, and restart Apache, I get the following errors:

  DBI connect('ORA001,'rt',...) failed: ERROR OCIEnvNlsCreate. Check
  ORACLE_HOME and NLS settings etc.
  at /usr/lib/perl5/site_perl/5.8.8/DBIx/SearchBuilder/Handle.pm line 106

  Connect Failed ERROR OCIEnvNlsCreate. (check ORACLE_HOME and NLS
  settings etc.)
  at /opt/rt3/lib/RT.pm line 220

I've placed

    qx,echo $ENV{'ORACLE_HOME'} > /tmp/debug,;
    qx,env > /tmp/debug2,;

and other statements in strategic places throughout the code and have
learned that when running without +Parent, the code can set %ENV and
child processes pick up the changes.  When running with +Parent, child
processes do not see any %ENV updates (and the Oracle connection fails).

Versions:

  oracle:       11.1.0.6.0
  rt:           3.6.5
  perl:         5.8.8
  mod_perl:     2.03
  HTML-Mason:   1.35
  httpd:        2.2.6
  linux:        2.6.22 (F7)

I've spent several hours on this trying different configurations but I
can't get Oracle to come up with the +Parent option.  Any help is
appreciated.  Thanks.


Re: +Parent breaks Oracle connection?

Posted by "George L. Roman" <gr...@arionsys.com>.
On Tue, November 13, 2007 8:34 am, Jim Brandt wrote:
> Where are those ENV variables being set? Is it in:
>
>      PerlRequire /opt/rt3/bin/webmux.pl
>
> I believe you need to make sure the second perl interpreter runs the
> same startup scripts as the first since it is completely new.

Yes, that's right, and that's what I'm doing.

I finally figured this out.  The docs say:

  <VirtualHost ...>
      ServerName dev1
      PerlOptions +Parent
      PerlSwitches -Mlib=/home/dev1/lib/perl
  </VirtualHost>

  <VirtualHost ...>
      ServerName dev2
      PerlOptions +Parent
      PerlSwitches -Mlib=/home/dev2/lib/perl
  </VirtualHost>

  http://perl.apache.org/docs/2.0/user/config/config.html#C_Parent_

but the problem I was running into was that the main (default) Apache
host wasn't using mod_perl.  The first time mod_perl was getting loaded
was in VirtualHost #1.  Setting +Parent at this point seems to confuse
mod_perl and reset the environment variable table to some minimal static
set.

What I've done is this (using the example above):

  <VirtualHost ...>
      ServerName dev1
      #PerlOptions +Parent  Don't load new interpreter -- this is the parent!
      PerlSwitches -Mlib=/home/dev1/lib/perl
  </VirtualHost>

  <VirtualHost ...>
      ServerName dev2
      PerlOptions +Parent
      PerlSwitches -Mlib=/home/dev2/lib/perl
  </VirtualHost>

Now both VirtualHosts run fine, and there's no need to pass variables
from httpd.conf as each RT install directory has its own set of
hardcoded database connection parameters compiled into its startup code.



Re: +Parent breaks Oracle connection?

Posted by Jim Brandt <cb...@buffalo.edu>.
Where are those ENV variables being set? Is it in:

     PerlRequire /opt/rt3/bin/webmux.pl

I believe you need to make sure the second perl interpreter runs the 
same startup scripts as the first since it is completely new.

Jim

George L. Roman wrote:
> I'm having trouble running RT using the
> 
>         PerlOptions +Parent
> 
> directive.
> 
> My httpd.conf file:
> 
>   NameVirtualHost *
> 
>   <VirtualHost *>
>     ServerName          default.name.com
>     DocumentRoot        "/var/www/html"
>     <Directory          "/var/www/html">
>         Options                 FollowSymLinks
>         AllowOverride           None
>         Order                   allow,deny
>         Allow                   from all
>     </Directory>
>   </VirtualHost>
> 
>   <VirtualHost *>
>     ServerName          rt.name.com
>     DocumentRoot        "/opt/rt3/share/html"
>     AddDefaultCharset   UTF-8
> 
>     ErrorLog            logs/error_log_rt
>     CustomLog           logs/access_log_rt combined
> 
>     # This PerlOptions line causes DB connect failure
>     #PerlOptions +Parent
> 
>     PerlRequire /opt/rt3/bin/webmux.pl
> 
>     <Location />
>         SetHandler      perl-script
>         PerlHandler     RT::Mason
>     </Location>
>   </VirtualHost>
> 
> This config file works great.  I can surf to rt (port 80) and login to
> RT.
> 
> When I uncomment the
> 
>     PerlOptions +Parent
> 
> line, however, and restart Apache, I get the following errors:
> 
>   DBI connect('ORA001,'rt',...) failed: ERROR OCIEnvNlsCreate. Check
>   ORACLE_HOME and NLS settings etc.
>   at /usr/lib/perl5/site_perl/5.8.8/DBIx/SearchBuilder/Handle.pm line 106
> 
>   Connect Failed ERROR OCIEnvNlsCreate. (check ORACLE_HOME and NLS
>   settings etc.)
>   at /opt/rt3/lib/RT.pm line 220
> 
> I've placed
> 
>     qx,echo $ENV{'ORACLE_HOME'} > /tmp/debug,;
>     qx,env > /tmp/debug2,;
> 
> and other statements in strategic places throughout the code and have
> learned that when running without +Parent, the code can set %ENV and
> child processes pick up the changes.  When running with +Parent, child
> processes do not see any %ENV updates (and the Oracle connection fails).
> 
> Versions:
> 
>   oracle:       11.1.0.6.0
>   rt:           3.6.5
>   perl:         5.8.8
>   mod_perl:     2.03
>   HTML-Mason:   1.35
>   httpd:        2.2.6
>   linux:        2.6.22 (F7)
> 
> I've spent several hours on this trying different configurations but I
> can't get Oracle to come up with the +Parent option.  Any help is
> appreciated.  Thanks.
> 

-- 
Jim Brandt
Administrative Computing Services
University at Buffalo