You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Andy Harrison <ah...@harrisonfamily.com> on 2004/04/19 20:53:13 UTC

mod_perl installation and non-standard perl path in FreeBSD

Hoping there might be another FreeBSD user here who may have been
through this already...

For reasons I don't want to trouble you with, I had to install the
latest perl freebsd port into /usr/local/rt3/perl/ and now I need to
get mod_perl to compile against that version.


I edited the freebsd port Makefile and added
MOD_PERLCONFIG=/usr/local/rt3/perl/bin/perl to CONFIGURE_ARGS and I
edited the shebang line in /usr/local/bin/apxs to point to my new
installation of perl.

Then, I tried using this cli in the mod_perl port directory.

bash-2.05b# PERL5LIB=/usr/local/rt3/perl/lib/site_perl/5.8.2/i386-freebsd PREFIX=/usr/local/rt3/perl SITE_PERL=/usr/local/rt3/perl/lib/site_perl make

While pieces of the compile output show that it is using
/usr/local/rt3/perl/*, most of it shows that it's pulling from
/usr/local/lib/perl5/* for libs.

I even combed through the work directory and manually changed the
references to the perl binary to /usr/local/rt3/perl/bin/perl with no
luck.  Same results every time.  And yes, I've been doing a make clean
in between compiles.

I have also editied the /etc/make.conf file so that the perl options are:

# grep PERL /etc/make.conf | grep '^[^#]'
 PERL_VER=5.8.2
 PERL_VERSION=5.8.2
 SITE_PERL=/usr/local/rt3/perl/lib/site_perl/${PERL_VER}
 PERL_ARCH=mach
 PERL5=/usr/local/rt3/perl/bin/perl
 PERL=/usr/local/rt3/perl/bin/perl
 NOPERL=yo
 NO_PERL=yo
 NO_PERL_WRAPPER=yo

 However, it doesn't even try to build the port now...

 # make
 Dependency error: you don't have the right version of perl in /usr/bin.
 *** Error code 1

 Stop in /usr/ports/www/mod_perl.

 I monkeyed with port's Makefile and added the variables there as well.

 # grep PERL Makefile | grep '^[^#]'
 MASTER_SITES=   ${MASTER_SITE_PERL_CPAN}
                 ${SITE_PERL}/LWP.pm:${PORTSDIR}/www/p5-libwww
 PERL_VER=5.8.2
 PERL_VERSION=5.8.2
 SITE_PERL=/usr/local/rt3/perl/lib/site_perl/${PERL_VER}
 PERL=                   /usr/local/rt3/perl/bin/perl
 PERL5=                  /usr/local/rt3/perl/bin/perl
 FULLPERL=               /usr/local/rt3/perl/bin/perl
 PERL_CONFIGURE= yes
 CONFIGURE_ARGS+=        USE_APXS=1 EVERYTHING=1 INSTALLSITELIB=${SITE_PERL} \
                         MOD_PERLCONFIG=/usr/local/rt3/perl/bin/perl \
                         INSTALLSITEARCH=${SITE_PERL}/${PERL_ARCH} \
                         PERL_EXTRA_CFLAGS='-DDEFAULT_PATH="/usr/local/rt3/perl/bin" -DAPPLLIB_EXP="/usr/local/rt3/perl/lib/perl5/5.8.2/BSDPAN" -DMOD_PERL_PREFIX="/usr/local/rt3/perl/lib/site_perl/5.8.2/i386-freebsd" -DDEFAULT_PATH="/usr/local/rt3/perl/bin"'

I'd think that things like MOD_PERL_PREFIX would help, but it's not
happening.

I can't alter the perl binary in /usr/bin/perl, so how can I force
mod_perl to compile using the perl binary in my non-standard perl
path?

Any advice?

-- 
Andy Harrison
(full headers for details)


-- 
Andy Harrison
Great Works Internet
System Operations
(full headers for details)

-- 
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html


Re: mod_perl installation and non-standard perl path in FreeBSD

Posted by Stas Bekman <st...@stason.org>.
Andy Harrison wrote:
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> On Mon, 19 Apr 2004 14:13:00 -0700, Stas Bekman wrote
> Subject: "Re: mod_perl installation and non-standard perl path in FreeBSD"
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> 
> 
>> Andy Harrison wrote:
>> > Hoping there might be another FreeBSD user here who may have been
>> > through this already...
>> > 
>> > For reasons I don't want to trouble you with, I had to install the
>> > latest perl freebsd port into /usr/local/rt3/perl/ and now I need to
>> > get mod_perl to compile against that version.
>>
>> Unless I miss something specific to FreeBSD ports, the whole thing should be 
>> as easy as doing:
>>
>> /usr/local/rt3/perl/bin/perl Makefile.PL ... && make && make test && make install
>>
>> I don't understand why are you trying to mess up with env vars at all. You 
>> obviously miss the first step, i.e. 'perl Makefile.PL'
> 
> 
> 
> I was hoping to get it working within the ports framework for future
> maintainability.  Since I'm not using a standard dir anyway, it
> doesn't look like it's going to be possible or worth any further
> effort.
> 
> Anyway, one more question related to this.  When building via apaci,
> it says to use APACHE_PREFIX.  What exactly is it looking for? FreeBSD
> doesn't install apache in a traditional spot all under one directory,
> such as /usr/local/apache.  It seems reasonable that it is looking for
> the directory where libperl.so is going to live
> (/usr/local/libexec/apache under FreeBSD).  Is this a good assumption?

I guess not.

http://perl.apache.org/docs/1.0/guide/install.html#APACHE_PREFIX

"mp1's APACHE_PREFIX" == "apache 1.3's --prefix="

If it doesn't apply under FreeBSD, don't use it. Instead use APACI_ARGS with 
an appropriate --libexecdir= flag.

Please send me a patch to make this clear in the docs. Thanks.

-- 
__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com

-- 
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html


[OT] Re: BerkeleyDB with mod perl

Posted by William McKee <wi...@knowmad.com>.
Hi Chris,

I sympathize with you. I've been through my share of problems with
BerkeleyDB as well. So far, I haven't had problems using it with
mod_perl. I wrote a stress test tool[1] to prove to myself that
BerkeleyDB was indeed safe to use in concurrent processes. You can set
it to run as many processes doing as many inserts and reads as you would
like. You may want to run that against a copy of your database to see if
it exposes any errors.

My mod_perl setup is on a Windows 2000 system and seems to be stable. I
setup my environment in the same way that you are doing except that I
pass in -ErrFile to the BerkeleyDB::Env setup. You may want to try that
to see if it provides any more details for you.

The only other suggestion I would make is to try without the tied
interface if you don't have to change too much code. Since you're using
db_put, you could setup just the handle via the following:

    my $bdb  = new BerkeleyDB::Btree
        -Flags    => DB_CREATE,
        -Filename => $dbfile,
        -Env      => $env,
        or die "Cannot open file $dbfile: $! - '$BerkeleyDB::Error'\n";


Good luck and let us know if you find a solution,
William

[1] http://perlmonks.org/index.pl?node_id=330510

-- 
Knowmad Services Inc.
http://www.knowmad.com

-- 
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html


Re: BerkeleyDB with mod perl

Posted by Chris Ochs <ch...@paymentonline.net>.
Yep sticking it in a global and handling it like Apache::DBI works.


----- Original Message ----- 
From: "Perrin Harkins" <pe...@elem.com>
To: "Chris Ochs" <ch...@paymentonline.net>
Cc: "Modperl List" <mo...@perl.apache.org>
Sent: Thursday, April 22, 2004 1:36 PM
Subject: Re: BerkeleyDB with mod perl


> On Thu, 2004-04-22 at 16:34, Chris Ochs wrote:
> > If I set the environment in startup.pl but open the db
> > handle in my perl handler every time the page is accessed the
performance
> > drops by about 300%, but it does make the errors go away.
>
> There is no need to open the handle every time.  You can open it once
> and put it in a global.  Just do it after the fork.  It's the same idea
> as Apache::DBI.
>
> - Perrin
>
>
> -- 
> Report problems: http://perl.apache.org/bugs/
> Mail list info: http://perl.apache.org/maillist/modperl.html
> List etiquette: http://perl.apache.org/maillist/email-etiquette.html
>
>


-- 
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html


Re: BerkeleyDB with mod perl

Posted by Perrin Harkins <pe...@elem.com>.
On Thu, 2004-04-22 at 16:34, Chris Ochs wrote:
> If I set the environment in startup.pl but open the db
> handle in my perl handler every time the page is accessed the performance
> drops by about 300%, but it does make the errors go away.

There is no need to open the handle every time.  You can open it once
and put it in a global.  Just do it after the fork.  It's the same idea
as Apache::DBI.

- Perrin


-- 
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html


Re: BerkeleyDB with mod perl

Posted by Chris Ochs <ch...@paymentonline.net>.
Sheesh yes I forgot to say that I set the environment and open the db handle
in startup.pl.  If I set the environment in startup.pl but open the db
handle in my perl handler every time the page is accessed the performance
drops by about 300%, but it does make the errors go away.

Chris


----- Original Message ----- 
From: "Perrin Harkins" <pe...@elem.com>
To: "Chris Ochs" <ch...@paymentonline.net>
Cc: "Modperl List" <mo...@perl.apache.org>
Sent: Thursday, April 22, 2004 1:12 PM
Subject: Re: BerkeleyDB with mod perl


> On Thu, 2004-04-22 at 15:55, Chris Ochs wrote:
> > I'm using the latest BerkeleyDB perl module on freebsd 5.2 with mod perl
> > 1.xx.  Following is the BerkeleyDB code I am using.  When I start
running
> > lots of concurrent processes that run db_put I get the error 'Locker
does
> > not exist' in $BerkeleyDB::Error and db_put returns 'Invalid argument'.
>
> Any chance you might be opening the db handle before forking, i.e. in
> your startup.pl?  I suspect that would cause problems.
>
> - Perrin
>
>


-- 
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html


Re: BerkeleyDB with mod perl

Posted by Perrin Harkins <pe...@elem.com>.
On Thu, 2004-04-22 at 16:27, William McKee wrote:
> My gut reaction is "Yes, this makes sense." However, I'm scratching my
> head trying to understand why.

There are file handles involved.  You can't fork with an open file and
expect to be able to do things with it from each process, at least not
without awareness and coordination between them.  I don't know enough
about BDB internals to say for sure what would happen, but this sort of
thing is often a problem with forking servers.

- Perrin


-- 
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html


Re: BerkeleyDB with mod perl

Posted by William McKee <wi...@knowmad.com>.
On Thu, Apr 22, 2004 at 04:12:51PM -0400, Perrin Harkins wrote:
> Any chance you might be opening the db handle before forking, i.e. in
> your startup.pl?  I suspect that would cause problems.

Hi Perrin,

My gut reaction is "Yes, this makes sense." However, I'm scratching my
head trying to understand why. It seems that all the children would
share the same locked environment. But perhaps, they shouldn't be
sharing the same handle (is this the equivalent of a connection?) to
that environment. Is that where the problem lies?  Does each child need
to have a separate handle?

Thanks,
William

-- 
Knowmad Services Inc.
http://www.knowmad.com

-- 
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html


Re: BerkeleyDB with mod perl

Posted by Perrin Harkins <pe...@elem.com>.
On Thu, 2004-04-22 at 15:55, Chris Ochs wrote:
> I'm using the latest BerkeleyDB perl module on freebsd 5.2 with mod perl
> 1.xx.  Following is the BerkeleyDB code I am using.  When I start running
> lots of concurrent processes that run db_put I get the error 'Locker does
> not exist' in $BerkeleyDB::Error and db_put returns 'Invalid argument'.

Any chance you might be opening the db handle before forking, i.e. in
your startup.pl?  I suspect that would cause problems.

- Perrin


-- 
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html


BerkeleyDB with mod perl

Posted by Chris Ochs <ch...@paymentonline.net>.
I know this isn't exactly mod perl specific, but since there isn't a mailing
list for BerkeleyDB and this is an issue I know people using BerkeleyDB and
mod perl have probably run accross I thought I would post it here.

I'm using the latest BerkeleyDB perl module on freebsd 5.2 with mod perl
1.xx.  Following is the BerkeleyDB code I am using.  When I start running
lots of concurrent processes that run db_put I get the error 'Locker does
not exist' in $BerkeleyDB::Error and db_put returns 'Invalid argument'.   I
must be setting up the environment incorrectly somehow.  I am trying to use
the BerkeleyDB concurrent data store mode which I assumed would handle all
the locking for me.


my %Cache;
my $env = new BerkeleyDB::Env(
      -Home  => '/tmp/bdb',
      -Flags => DB_INIT_CDB | DB_CREATE | DB_INIT_MPOOL,
      )
      or die "can't create BerkelyDB::Env: $!";

  my $bdb = tie %Cache, 'BerkeleyDB::Hash',
     -Filename => '/tmp/bdb/bdbfile',
     -Flags    => DB_CREATE,
     -Mode     => 0640,
     -Env      => $env
     or die ("Can't tie to /tmp/bdb/bdbdfile: $!");


My db_put looks like this:
my $status = $bdb->db_put($key,$value);

Chris


-- 
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html


Re: mod_perl installation and non-standard perl path in FreeBSD

Posted by William McKee <wi...@knowmad.com>.
Hi Andy,

I use Apache/mod_perl under FreeBSD. I compile with Apachetoolbox[1]
which is super easy. Here are the custom settings I use:

    --suexec-caller=www \
    --suexec-docroot=/web \
    --disable-rule=EXPAT \

    # if using mod_ssl 
    --enable-rule=EAPI

Otherwise, I let toolbox do the work. Check the docs but I'm pretty sure
that the APACHE_PREFIX path is where apache will be installed.


William

[1] http://apachetoolbox.com/

-- 
Knowmad Services Inc.
http://www.knowmad.com

-- 
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html


Re: mod_perl installation and non-standard perl path in FreeBSD

Posted by Andy Harrison <ah...@harrisonfamily.com>.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
On Mon, 19 Apr 2004 14:13:00 -0700, Stas Bekman wrote
Subject: "Re: mod_perl installation and non-standard perl path in FreeBSD"
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

>  Andy Harrison wrote:
>  > Hoping there might be another FreeBSD user here who may have been
>  > through this already...
>  > 
>  > For reasons I don't want to trouble you with, I had to install the
>  > latest perl freebsd port into /usr/local/rt3/perl/ and now I need to
>  > get mod_perl to compile against that version.
> 
>  Unless I miss something specific to FreeBSD ports, the whole thing should be 
>  as easy as doing:
> 
>  /usr/local/rt3/perl/bin/perl Makefile.PL ... && make && make test && make install
> 
>  I don't understand why are you trying to mess up with env vars at all. You 
>  obviously miss the first step, i.e. 'perl Makefile.PL'


I was hoping to get it working within the ports framework for future
maintainability.  Since I'm not using a standard dir anyway, it
doesn't look like it's going to be possible or worth any further
effort.

Anyway, one more question related to this.  When building via apaci,
it says to use APACHE_PREFIX.  What exactly is it looking for? FreeBSD
doesn't install apache in a traditional spot all under one directory,
such as /usr/local/apache.  It seems reasonable that it is looking for
the directory where libperl.so is going to live
(/usr/local/libexec/apache under FreeBSD).  Is this a good assumption?



-- 
Andy Harrison
Great Works Internet
System Operations
(full headers for details)

-- 
Andy Harrison
Great Works Internet
System Operations
(full headers for details)

-- 
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html


Re: mod_perl installation and non-standard perl path in FreeBSD

Posted by Stas Bekman <st...@stason.org>.
Andy Harrison wrote:
> Hoping there might be another FreeBSD user here who may have been
> through this already...
> 
> For reasons I don't want to trouble you with, I had to install the
> latest perl freebsd port into /usr/local/rt3/perl/ and now I need to
> get mod_perl to compile against that version.

Unless I miss something specific to FreeBSD ports, the whole thing should be 
as easy as doing:

/usr/local/rt3/perl/bin/perl Makefile.PL ... && make && make test && make install

I don't understand why are you trying to mess up with env vars at all. You 
obviously miss the first step, i.e. 'perl Makefile.PL'

__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com

-- 
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html