You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Scott Cain <ca...@cshl.edu> on 2005/04/19 22:05:25 UTC

Apache1/mp1 and Apache2/mp2 on the same machine

Hello,

I imagine that this question has been asked before, but my google skills
are failing me at the moment.  Here's the thing: I have users who would
like to keep their apache1/mp1 setup in place while they work on the
same machine testing apache2/mp2.  When I tried to do a similar thing a
month or so ago, I seemed to suffer from "mod_perl1 poisoning": even
though I was using Apache2 and mod_perl2, I would get error messages
coming from mod_perl1 modules.  This was after supplying the
MP_INST_APACHE2=1, and I was under the impression that this would let me
do exactly what I wanted.  This was with RC4.  The only way I could fix
it was to remove everything from my perl libs that had Apache or
mod_perl associations and then reinstall mod_perl2.

So, the question is: is it possible (and relatively easy) to have
mod_perl1 and mod_perl2 installed on the same machine?

Thanks,
Scott

-- 
------------------------------------------------------------------------
Scott Cain, Ph. D.                                         cain@cshl.org
GMOD Coordinator (http://www.gmod.org/)                     216-392-3087
Cold Spring Harbor Laboratory


Re: Apache1/mp1 and Apache2/mp2 on the same machine

Posted by Scott Cain <ca...@cshl.edu>.
Philip,

Thanks!  That is very useful info--I will forward it to the turnkey
developers (it's not my project, just related to one I am working on).

Scott

On Tue, 2005-04-19 at 17:26 -0400, Philip M. Gollucci wrote:
> Scott Cain wrote:
> 
> >I am using turnkey (http://turnkey.sf.net) which tries to do some fancy
> >footwork to determine which mod_perl is being used:
> >
> >(note that Turnkey::Root::mod_perl_version parses $ENV{MOD_PERL} and
> >returns 2 if it looks like mod_perl 1.99+ or 1 otherwise):
> >  
> >
> Thats not going to run under mp2 RC5+
> Its Apache2::Request etc..
> 
> It should check $ENV{MOD_PERL_API_VERSION} == 2 to determine if its 
> running mp2 RC5+
> which should be the only version of mp2 it supports until an official 
> 2.0 release is made.
> 
-- 
------------------------------------------------------------------------
Scott Cain, Ph. D.                                         cain@cshl.org
GMOD Coordinator (http://www.gmod.org/)                     216-392-3087
Cold Spring Harbor Laboratory


Re: Apache1/mp1 and Apache2/mp2 on the same machine

Posted by "Philip M. Gollucci" <pg...@p6m7g8.com>.
Scott Cain wrote:

>I am using turnkey (http://turnkey.sf.net) which tries to do some fancy
>footwork to determine which mod_perl is being used:
>
>(note that Turnkey::Root::mod_perl_version parses $ENV{MOD_PERL} and
>returns 2 if it looks like mod_perl 1.99+ or 1 otherwise):
>  
>
Thats not going to run under mp2 RC5+
Its Apache2::Request etc..

It should check $ENV{MOD_PERL_API_VERSION} == 2 to determine if its 
running mp2 RC5+
which should be the only version of mp2 it supports until an official 
2.0 release is made.

-- 
END
-----------------------------------------------------------------------------
Philip M. Gollucci
Senior Developer - Liquidity Services Inc.
Phone:  202.558.6268 (Direct)
E-Mail: pgollucci@liquidation.com
Web:    http://www.liquidation.com


Re: Apache1/mp1 and Apache2/mp2 on the same machine

Posted by Scott Cain <ca...@cshl.edu>.
I am using turnkey (http://turnkey.sf.net) which tries to do some fancy
footwork to determine which mod_perl is being used:

(note that Turnkey::Root::mod_perl_version parses $ENV{MOD_PERL} and
returns 2 if it looks like mod_perl 1.99+ or 1 otherwise):

if (Turnkey::Root::mod_perl_version( $ENV{MOD_PERL} ) == 1) {

    # do mod_perl1 set up stuff, like:

  $STRATEGY_COOKIE  = 'Apache::Cookie';
  $STRATEGY_REQUEST = 'Apache::Request';

  eval qq(
    use Apache::Constants qw(:common DECLINED REDIRECT);
    use Apache::Request;
    use Apache::Cookie;
  );

} elsif (Turnkey::Root::mod_perl_version( $ENV{MOD_PERL} ) == 2) {

    # do mod_perl2 set up stuff, like:

  $STRATEGY_COOKIE  = 'CGI::Cookie';
  $STRATEGY_REQUEST = 'Apache::RequestRec';

  eval qq(
    use Apache::Const -compile => qw(:common :http REDIRECT M_GET);
    use Apache::RequestUtil;
    use APR::Table;
    use CGI::Cookie;
    use Apache::ParseFormData;

    $declined = Apache::DECLINED;
    $not_implemented = Apache::HTTP_NOT_IMPLEMENTED;
    $m_get = Apache::M_GET;
  );

} else {
  die("what kind of mod_perl is '".mod_perl_version( $ENV{MOD_PERL} )."'?");
}

Here is Turnkey::Root::mod_perl_version:

BEGIN {
  sub mod_perl_version {
    my $MOD_PERL_VERSION = shift if @_;

    $MOD_PERL_VERSION =~ s/^.*?([\d.]+).*?$/$1/;
    eval "require mod_perl";

    if($MOD_PERL_VERSION >= 1.99){
      $MOD_PERL_VERSION = 2;
    } else {
      $MOD_PERL_VERSION = 1;
    }

    return $MOD_PERL_VERSION;
  }
}

Is there any reason to believe that would work now as opposed to not
working before?  It appeared that before, at least some of the time,
even though I was using Apache2, the mod_perl_version method would
return '1' and muck things up.

Thanks,
Scott


On Tue, 2005-04-19 at 17:11 -0400, Philip M. Gollucci wrote:
> Scott Cain wrote:
> 
> >I did see the rename doc, though I didn't realize that it applied to
> >something as recent as the transition to RC4->RC5.  Are you currently
> >using mp1 and mp2?  What about any mp applications that were written
> >prior to this name change?   Of course, I can't do any testing myself,
> >because I had to blow away my installation of mp1 to get my mp2 apps to
> >work.
> >  
> >
> Yes, I have both mp1 and mp2 installed on my laptop.
> You'd have to be more specific about applications.
> Some work some don't :)
> 
> 
-- 
------------------------------------------------------------------------
Scott Cain, Ph. D.                                         cain@cshl.org
GMOD Coordinator (http://www.gmod.org/)                     216-392-3087
Cold Spring Harbor Laboratory


Re: Apache1/mp1 and Apache2/mp2 on the same machine

Posted by "Philip M. Gollucci" <pg...@p6m7g8.com>.
Scott Cain wrote:

>I did see the rename doc, though I didn't realize that it applied to
>something as recent as the transition to RC4->RC5.  Are you currently
>using mp1 and mp2?  What about any mp applications that were written
>prior to this name change?   Of course, I can't do any testing myself,
>because I had to blow away my installation of mp1 to get my mp2 apps to
>work.
>  
>
Yes, I have both mp1 and mp2 installed on my laptop.
You'd have to be more specific about applications.
Some work some don't :)


-- 
END
-----------------------------------------------------------------------------
Philip M. Gollucci
Senior Developer - Liquidity Services Inc.
Phone:  202.558.6268 (Direct)
E-Mail: pgollucci@liquidation.com
Web:    http://www.liquidation.com


Re: Apache1/mp1 and Apache2/mp2 on the same machine

Posted by Scott Cain <ca...@cshl.edu>.
That's a good point.  I will at least suggest it to them.

Scott

On Tue, 2005-04-19 at 17:37 -0400, Perrin Harkins wrote:
> On Tue, 2005-04-19 at 17:21 -0400, Scott Cain wrote:
> > That is a great idea and I will use it in the future.  Unfortunately, it
> > doesn't really help my users who, while very bright, are not perl
> > developers and would likely balk at doing that.
> 
> I do something similar to what Cliff has here.  There's nothing special
> for the users to know except the URL of the server they want to talk to.
> 
> You already need to install a separate apache for mod_perl 2 anyway, so
> installing a separate perl doesn't seem like a big extra to me, although
> technically it is not needed for many things anymore now that modules go
> into the Apache2:: namespace.  I prefer to have a separate perl so that
> I know for certain which modules I'm using and can port things without
> breaking the existing code.
> 
> - Perrin
> 
> 
-- 
------------------------------------------------------------------------
Scott Cain, Ph. D.                                         cain@cshl.org
GMOD Coordinator (http://www.gmod.org/)                     216-392-3087
Cold Spring Harbor Laboratory


Re: Apache1/mp1 and Apache2/mp2 on the same machine

Posted by Perrin Harkins <pe...@elem.com>.
On Tue, 2005-04-19 at 17:21 -0400, Scott Cain wrote:
> That is a great idea and I will use it in the future.  Unfortunately, it
> doesn't really help my users who, while very bright, are not perl
> developers and would likely balk at doing that.

I do something similar to what Cliff has here.  There's nothing special
for the users to know except the URL of the server they want to talk to.

You already need to install a separate apache for mod_perl 2 anyway, so
installing a separate perl doesn't seem like a big extra to me, although
technically it is not needed for many things anymore now that modules go
into the Apache2:: namespace.  I prefer to have a separate perl so that
I know for certain which modules I'm using and can port things without
breaking the existing code.

- Perrin


Re: Apache1/mp1 and Apache2/mp2 on the same machine

Posted by Scott Cain <ca...@cshl.edu>.
That is a great idea and I will use it in the future.  Unfortunately, it
doesn't really help my users who, while very bright, are not perl
developers and would likely balk at doing that.

Thanks,
Scott

On Tue, 2005-04-19 at 14:14 -0700, ___cliff rayman___ wrote:
> Scott Cain wrote:
> 
> >because I had to blow away my installation of mp1 to get my mp2 apps to
> >work.
> >
> >
> >  
> >
> I always build my servers with their own copy of perl in a directory 
> such as:
> /usr/local/httpd_20050419
> 
> I build a fresh perl and apache in that directory, and get everything 
> working.  My particular builds include a separate front end with SSL, 
> and two backends, one each of mod_perl and mod_php.  I then use 
> mod_rewrite to send requests to the correct back end.
> 
> After I have everything working, I then stop and unlink the 
> existing/running apache and then link
> ln -s /usr/local/httpd_20050419/apache_front /usr/local/apache_front
> ln -s /usr/local/httpd_20050419/apache_perl /usr/local/apache_perl
> ln -s /usr/local/httpd_20050419/apache_php /usr/local/apache_php
> ln -s /usr/local/httpd_20050419/perl/bin/perl /usr/local/bin/perl58xx
> 
> I can always go back to my previous set-up if I have problems.
> 
-- 
------------------------------------------------------------------------
Scott Cain, Ph. D.                                         cain@cshl.org
GMOD Coordinator (http://www.gmod.org/)                     216-392-3087
Cold Spring Harbor Laboratory


Re: Apache1/mp1 and Apache2/mp2 on the same machine

Posted by ___cliff rayman___ <cl...@rayman.com>.
Scott Cain wrote:

>because I had to blow away my installation of mp1 to get my mp2 apps to
>work.
>
>
>  
>
I always build my servers with their own copy of perl in a directory 
such as:
/usr/local/httpd_20050419

I build a fresh perl and apache in that directory, and get everything 
working.  My particular builds include a separate front end with SSL, 
and two backends, one each of mod_perl and mod_php.  I then use 
mod_rewrite to send requests to the correct back end.

After I have everything working, I then stop and unlink the 
existing/running apache and then link
ln -s /usr/local/httpd_20050419/apache_front /usr/local/apache_front
ln -s /usr/local/httpd_20050419/apache_perl /usr/local/apache_perl
ln -s /usr/local/httpd_20050419/apache_php /usr/local/apache_php
ln -s /usr/local/httpd_20050419/perl/bin/perl /usr/local/bin/perl58xx

I can always go back to my previous set-up if I have problems.

-- 
_____cliff_rayman_____________________________________
Business Consulting and Turnaround Management
[web] http://www.rayman.com/
[web] http://all-clear-turnaround-management.com/
[eml] cliff  _AT_ rayman.com
[phn] 888-736-3802 x701
[fax] 818-743-7404
______________________________________________________


Re: Apache1/mp1 and Apache2/mp2 on the same machine

Posted by Scott Cain <ca...@cshl.edu>.
I did see the rename doc, though I didn't realize that it applied to
something as recent as the transition to RC4->RC5.  Are you currently
using mp1 and mp2?  What about any mp applications that were written
prior to this name change?   Of course, I can't do any testing myself,
because I had to blow away my installation of mp1 to get my mp2 apps to
work.


On Tue, 2005-04-19 at 16:51 -0400, Philip M. Gollucci wrote:
> Sc
> 
> >So, the question is: is it possible (and relatively easy) to have
> >mod_perl1 and mod_perl2 installed on the same machine?
> >  
> >
> Try mod_perl2.00 RC5 seems to work for me :)
> 
> MP_APACHE2_INST=1 is gone.
> 
> mod_perl.pm is installed as mod_perl2.pm
> and mp2 libs are in Apache2:: directory and namespace by default.
> 
> See this:
> http://perl.apache.org/docs/2.0/rename.html
> 
> >Thanks,
> >Scott
> >
> >  
> >
> 
> 
-- 
------------------------------------------------------------------------
Scott Cain, Ph. D.                                         cain@cshl.org
GMOD Coordinator (http://www.gmod.org/)                     216-392-3087
Cold Spring Harbor Laboratory


Re: Apache1/mp1 and Apache2/mp2 on the same machine

Posted by "Philip M. Gollucci" <pg...@p6m7g8.com>.
Sc

>So, the question is: is it possible (and relatively easy) to have
>mod_perl1 and mod_perl2 installed on the same machine?
>  
>
Try mod_perl2.00 RC5 seems to work for me :)

MP_APACHE2_INST=1 is gone.

mod_perl.pm is installed as mod_perl2.pm
and mp2 libs are in Apache2:: directory and namespace by default.

See this:
http://perl.apache.org/docs/2.0/rename.html

>Thanks,
>Scott
>
>  
>


-- 
END
-----------------------------------------------------------------------------
Philip M. Gollucci
Senior Developer - Liquidity Services Inc.
Phone:  202.558.6268 (Direct)
E-Mail: pgollucci@liquidation.com
Web:    http://www.liquidation.com