Re: mp2 on osx jaguar won't load mod_perl.so

2003-08-15 Thread Stas Bekman
Douglas, when reporting problems/bugs please follow the guidelines at 
http://perl.apache.org/bugs/

It's a known issue with certain builds of perl, please look in the list 
archives for similar reports.

Several people reported success with max os x using perl built with usethreads 
enabled. Here is one of them:
http://marc.theaimsgroup.com/?l=apache-modperl-dev&m=105955380011549&w=2

__
Stas BekmanJAm_pH --> Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide ---> http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com


--
Reporting bugs: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html


mp2 on osx jaguar won't load mod_perl.so

2003-08-15 Thread Douglas Theobald
I've been quite successful with mp1 (Apache/1.3.28, mod_perl/1.28, perl
5.8.0, OSX jaguar 10.2.6.), but I'd really like to get mp2 going on OSX.
Has anyone had any luck or experienced this same problem?

Apache2, by itself, appears to compile and run just fine. I've found no
problems so far (though I'm not using it much since I want/need mp). I get
mp2 to compile without errors or warnings, and it successfully gives me a
mod_perl.a and mod_perl.so, and will install them in apache2 correctly.
However, "make test" fails with a "server failed to start!" error (full
output below). 

I decided to screw the test and see what I could get it to do manually, so I
modified httpd.conf as described in the docs (added "LoadModule perl_module
modules/mod_perl.so" and "PerlModule Apache2"). Commands such as "apachectl
start" and "httpd -k start" appear to work with no error or output
whatsoever, but httpd never fires up ('ps -aux | grep httpd' gives zilch).
Likewise, the error_log logs nothing. As soon as I commnet out the two perl
module lines in httpd.conf, httpd runs again just fine.

Now here's the strange part: if comment out the perl module lines in
httpd.conf and fire up httpd, *then* uncomment them and restart httpd, it
works temporarily. Mp modules run, my mod_perl directory has working mp
executables, etc. Even error_log registers "[notice] Apache/2.0.47 (Unix)
mod_perl/1.99_09 Perl/v5.8.0 configured -- resuming normal operations." At
least for a while, then it seems to stop working. An additional "apachectl
restart" definitely kills it and the server dies dead. Again, nothing to the
error_log or stdout/stderr.

Any ideas??

Here's the full mp2 "sudo make test" output:

chem134-218-dhcp/theobal> sudo make test
cd "src/modules/perl" && make -f Makefile.modperl
make[1]: Nothing to be done for `all'.
/usr/bin/perl -Iblib/arch/Apache2 -Iblib/lib/Apache2 \
t/TEST -clean
*** setting ulimit to allow core files
ulimit -c unlimited; t/TEST -clean
APACHE_USER= APACHE_GROUP= APACHE_PORT= APACHE= APXS= \
/usr/bin/perl -Iblib/arch/Apache2 -Iblib/lib/Apache2 \
t/TEST -verbose=0 
*** setting ulimit to allow core files
ulimit -c unlimited; t/TEST -verbose=0
*** root mode: changing the fs ownership to 'nobody' (4294967294:4294967294)
/usr/local/apache2//bin/httpd  -d /usr/local/mod_perl-1.99_09/t -f
/usr/local/mod_perl-1.99_09/t/conf/httpd.conf -DAPACHE2
using Apache/2.0.47 (prefork MPM)

waiting for server to start: ..[Fri Aug 15 23:35:16 2003] [info] 19 Apache::
modules loaded
[Fri Aug 15 23:35:16 2003] [info] 3 APR:: modules loaded
[Fri Aug 15 23:35:16 2003] [info] base server + 8 vhosts ready to run tests
...
waiting for server to start: giving up after 61 secs
!!! server failed to start! (please examine t/logs/error_log)
make: *** [run_tests] Error 1


And here's t/logs/error_log:

END in modperl_extra.pl, pid=25065





-- 
Reporting bugs: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html



Re: Odd Reload Behavior

2003-08-15 Thread Ged Haywood
Hello again,

On Fri, 15 Aug 2003, Cory 'G' Watson wrote:

> PerlVar app blah
> 
>   App->loadApp("blah", "/usr/local/blah/lib");
> 
> [snip]
> Ignore syntax errors and lack of declarations, as I just threw that 
> together from memory

The guesswork would be a lot easier if it didn't involve so much guesswork. :)

Have you read

http://perl.apache.org/docs/1.0/guide/config.html#PerlSetVar_and_PerlAddVar

and

http://perl.apache.org/docs/1.0/guide/config.html#Apache_Configuration_in_Perl

?

73,
Ged.



-- 
Reporting bugs: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html



Re: Odd Reload Behavior

2003-08-15 Thread Cory 'G' Watson
On Friday, August 15, 2003, at 12:43  PM, Ged Haywood wrote:
I'm not entirely convinced of the explanation, but have you tried
testing the value of $Apache::Server::ReStarting in the code that
fills the hash?  It's in the Guide.
I'm not convinced of it either. :)

This code _would_ run twice, so I can protect it using the variable you 
specified.  I didn't know it existed.  List messages seem to say that 
this shouldn't be used?

Your message was a bit cavalier about what's a hash and what's a
hashref, are you sure you aren't just missing a dereference somewhere?
Have you got 'use strict' and warnings on.
It's a difficult concept to relay without pasting a bunch of code.

-- App.pm:

package App;

my %pageobjs;

sub loadApp {
my $self = shift();
my $name = shift();
my $libdir = shift();
	my %pages;
	opendir(LIBDIR, $libdir);
	while(there are files to check) {
   # blah, if the file is a .pm, require and instantiate it into 
$page
   $pages{$pageObjectName} = $page;
	closedir(LOBDIR);
	$pageobjs{$name} = \%pages;
}

sub getPages {
my $self = shift();
 my $name = shift();
return $pageobjs{$name};
}
-- startup.pl:

use App;

Sooo, using the above code, the VHost uses:

PerlVar app blah

 App->loadApp("blah", "/usr/local/blah/lib");

And, inside the Handler:

my $app = $r->dir_config("app");
my $hashRefOfPageObjs = App->getPages($app);
And $hashRefOfPageObjs is always undef;

Ignore syntax errors and lack of declarations, as I just threw that 
together from memory into the ol' MUA here.  Does that make more sense? 
 I believe I had this working at one point, but something has caused it 
go south.  The double load I see (which you explained with your 
Restarting tip) was suspect only because if I put code into App which 
Data::Dumper's the hash, there is something in it, but it disappears 
between the first load and the first request.  It looks like  
sections are executed twice, but this shouldn't cause the variable to 
go undefined.

Cory 'G' Watson
http://www.loggerithim.org


--
Reporting bugs: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html


Re: Odd Reload Behavior

2003-08-15 Thread Ged Haywood
Hi there,

On Fri, 15 Aug 2003, Cory 'G' Watson wrote:

> It looks as though this works during the first 'load' that Apache does, 
> which I'm assuming is the phase that checks for errors.  The second 
> phase seems to cause my global hash to get undef'ed, even though the 
> loadPages() method works properly.

I'm not entirely convinced of the explanation, but have you tried
testing the value of $Apache::Server::ReStarting in the code that
fills the hash?  It's in the Guide.

Your message was a bit cavalier about what's a hash and what's a
hashref, are you sure you aren't just missing a dereference somewhere?
Have you got 'use strict' and warnings on?

73,
Ged.



-- 
Reporting bugs: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html



Re: Trouble getting mod_perl and apache running with Apache::DBI

2003-08-15 Thread K Old
I left out my version of Perl.  I'm using 5.6.1 from RPM.

Kevin

On Fri, 2003-08-15 at 10:34, K Old wrote:
> Hello everyone,
> 
> I've set mod_perl up with Apache::DBI on several servers, both with
> mod_perl from RPM's and building it myself, but I am having a horrible
> time with a new server I've just built.  Go easy, I'm still new at it,
> though.  And I welcome any and all constructive criticism for my config
> files, etc.
> 
> Here are the specs:  RH 7.3, mod_perl 1.2.6 from RPM, Apache::DBI 0.92,
> DBI 1.37.
> 
> Now, here's what I'm defining in httpd.conf:
> 
> 
> Alias /perl /var/www/perl
> 
> SetHandler perl-script
> PerlHandler Apache::Registry
> Options +ExecCGI
> 
> 
> #PerlHandler HTML::Mason::ApacheHandler
> PerlSetVar MasonCompRoot /var/www/html/mason
> PerlSetVar MasonDataDir /var/mason
> PerlSetVar MasonAllowGlobals $dbh
> #PerlAddVar MasonAllowGlobals $session
> #PerlAddVar MasonAllowGlobals %session
> #PerlAddVar MasonAllowGlobals $sys
> #PerlSetVar MasonRequestClass MasonX::Request::WithApacheSession
> #PerlSetVar MasonSessionClass Apache::Session::File
> #PerlSetVar MasonSessionDirectory /tmp/sessions
> #PerlSetVar MasonSessionLockDirectory /tmp/sessions
> PerlSetEnv DBI_TRACE "3=/tmp/dbitrace.log"
> PerlRequire /etc/httpd/conf/startup.pl
> #PerlModule Apache::DBI
> AddType text/html .mhtml
> AddType text/html .mason
> 
> SetHandler  perl-script
> PerlHandler HTML::Mason::ApacheHandler
> Options +ExecCGI
> 
> 
> 
> 
> 
> 
> Here's my startup.pl:
> 
> 
> #!/usr/bin/perl
> use warnings;
> use strict;
> 
> # Extend @INC if needed
> #use lib qw(/dir/foo /dir/bar);
> use lib qw(/var/www/html/mason/lib);
> use lib qw(/var/www/html/mason/hrtime/lib);
> 
> 
> use vars qw($dbh %session);
> 
> 
> # Make sure we are in a sane environment.
> $ENV{MOD_PERL} or die "not running under mod_perl!";
> 
> # For things in the "/perl" URL
> use Apache::Registry;
> #$KO::server_root = "/var/www/html/mason/db";
> #use KO::DBI::Connect qw(:all);
> # Load Perl modules of your choice here
> # This code is interpreted *once* when the server starts
> use LWP::UserAgent ();
> #use Apache::DBI ();
> use DBI();
> 
> # Tell me more about warnings
> use Carp();
> $SIG{__WARN__} = \&Carp::cluck;
> 
> # Load CGI.pm and call its compile() method to precompile 
> # (but not to import) its autoloaded methods.
> 
> use CGI ();
> CGI->compile(':all');
> 
> # Initialize the database connections for each child
> =pod
> Apache::DBI->connect_on_init
>   ("DBI:Pg:dbname=auth;host=localhost;port=5432",
>"root","",
>{
> PrintError => 1, # warn() on errors
> RaiseError => 0, # don't die on error
> AutoCommit => 1, # commit executes immediately
>}
>   );
> =cut
> 1;
> 
> 
> 
> 
> What's happening is that with "use Apache::DBI" uncommented in either
> the httpd.conf or startup.pl Apache does not start.  This is what
> error_log reports:
> 
> [Thu Aug 14 14:59:49 2003] [notice] Apache/1.3.27 (Unix) 
> (Red-Hat/Linux) mod_ssl/2.8.7 OpenSSL/0.9.6b DAV/1.0.3 PHP/4.1.2
> mod_perl/1.26 mod_throttle/3.1.2 configured -- resuming normal
> operations
> [Thu Aug 14 14:59:49 2003] [notice] suEXEC mechanism enabled (wrapper:
> /usr/sbin/suexec)
> [Thu Aug 14 14:59:49 2003] [notice] Accept mutex: sysvsem (Default:
> sysvsem)
> [Fri Aug 15 10:08:43 2003] [notice] caught SIGTERM, shutting down
> 
> When I try to pull up anything the connection is refused (because the
> server is down).
> 
> I've just been commenting and uncommenting stuff until it worked.  The
> weird thing is that there are no real error messages from mod_perl in
> the apache logs.
> 
> Can anyone help?
> Thanks,
> Kevin
> -- 
> K Old <[EMAIL PROTECTED]>
-- 
K Old <[EMAIL PROTECTED]>



-- 
Reporting bugs: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html



Trouble getting mod_perl and apache running with Apache::DBI

2003-08-15 Thread K Old
Hello everyone,

I've set mod_perl up with Apache::DBI on several servers, both with
mod_perl from RPM's and building it myself, but I am having a horrible
time with a new server I've just built.  Go easy, I'm still new at it,
though.  And I welcome any and all constructive criticism for my config
files, etc.

Here are the specs:  RH 7.3, mod_perl 1.2.6 from RPM, Apache::DBI 0.92,
DBI 1.37.

Now, here's what I'm defining in httpd.conf:


Alias /perl /var/www/perl

SetHandler perl-script
PerlHandler Apache::Registry
Options +ExecCGI


#PerlHandler HTML::Mason::ApacheHandler
PerlSetVar MasonCompRoot /var/www/html/mason
PerlSetVar MasonDataDir /var/mason
PerlSetVar MasonAllowGlobals $dbh
#PerlAddVar MasonAllowGlobals $session
#PerlAddVar MasonAllowGlobals %session
#PerlAddVar MasonAllowGlobals $sys
#PerlSetVar MasonRequestClass MasonX::Request::WithApacheSession
#PerlSetVar MasonSessionClass Apache::Session::File
#PerlSetVar MasonSessionDirectory /tmp/sessions
#PerlSetVar MasonSessionLockDirectory /tmp/sessions
PerlSetEnv DBI_TRACE "3=/tmp/dbitrace.log"
PerlRequire /etc/httpd/conf/startup.pl
#PerlModule Apache::DBI
AddType text/html .mhtml
AddType text/html .mason

SetHandler  perl-script
PerlHandler HTML::Mason::ApacheHandler
Options +ExecCGI






Here's my startup.pl:


#!/usr/bin/perl
use warnings;
use strict;

# Extend @INC if needed
#use lib qw(/dir/foo /dir/bar);
use lib qw(/var/www/html/mason/lib);
use lib qw(/var/www/html/mason/hrtime/lib);


use vars qw($dbh %session);


# Make sure we are in a sane environment.
$ENV{MOD_PERL} or die "not running under mod_perl!";

# For things in the "/perl" URL
use Apache::Registry;
#$KO::server_root = "/var/www/html/mason/db";
#use KO::DBI::Connect qw(:all);
# Load Perl modules of your choice here
# This code is interpreted *once* when the server starts
use LWP::UserAgent ();
#use Apache::DBI ();
use DBI();

# Tell me more about warnings
use Carp();
$SIG{__WARN__} = \&Carp::cluck;

# Load CGI.pm and call its compile() method to precompile 
# (but not to import) its autoloaded methods.

use CGI ();
CGI->compile(':all');

# Initialize the database connections for each child
=pod
Apache::DBI->connect_on_init
  ("DBI:Pg:dbname=auth;host=localhost;port=5432",
   "root","",
   {
PrintError => 1, # warn() on errors
RaiseError => 0, # don't die on error
AutoCommit => 1, # commit executes immediately
   }
  );
=cut
1;




What's happening is that with "use Apache::DBI" uncommented in either
the httpd.conf or startup.pl Apache does not start.  This is what
error_log reports:

[Thu Aug 14 14:59:49 2003] [notice] Apache/1.3.27 (Unix) 
(Red-Hat/Linux) mod_ssl/2.8.7 OpenSSL/0.9.6b DAV/1.0.3 PHP/4.1.2
mod_perl/1.26 mod_throttle/3.1.2 configured -- resuming normal
operations
[Thu Aug 14 14:59:49 2003] [notice] suEXEC mechanism enabled (wrapper:
/usr/sbin/suexec)
[Thu Aug 14 14:59:49 2003] [notice] Accept mutex: sysvsem (Default:
sysvsem)
[Fri Aug 15 10:08:43 2003] [notice] caught SIGTERM, shutting down

When I try to pull up anything the connection is refused (because the
server is down).

I've just been commenting and uncommenting stuff until it worked.  The
weird thing is that there are no real error messages from mod_perl in
the apache logs.

Can anyone help?
Thanks,
Kevin
-- 
K Old <[EMAIL PROTECTED]>



-- 
Reporting bugs: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html



Odd Reload Behavior

2003-08-15 Thread Cory 'G' Watson
I've recently written some code that behaves in a way I don't 
understand.  It's basically a Handler that works for more than one 
VirtualHost.  For each VirtualHost that uses the Handler, a call is 
made to App->loadPages().  It crawls an accompanying lib directory and 
loads the pages into a hashref, which is then stored in a global hash 
inside App.

Later, during requests, the Handler calls App->getPages("key"), where 
key is a unique name for each virtual host.  This _should_ return a 
hashref full of page objects, but it returns undef.

Since the App module is pre-loaded (in startup.pl), and loadPages() 
fills the hash, shouldn't the Handler's calls to getPages(key) work?  I 
know it can, because I had it working a couple weeks ago, but something 
has broken it.

It looks as though this works during the first 'load' that Apache does, 
which I'm assuming is the phase that checks for errors.  The second 
phase seems to cause my global hash to get undef'ed, even though the 
loadPages() method works properly.

I can divulge more code if necessary, but perhaps someone can clue me 
into why this happens.

Cory 'G' Watson
http://www.loggerithim.org


--
Reporting bugs: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html