Apache2::Subprocess not fully working on Windows XP?

2007-10-23 Thread Marc Elser

Hi,

I'm using Apache2.2 precompiled binary on my Windows XP Professional
with ActivePerl 5.8.8 and mod_perl 2.0.3.

Problem is I want to start a subprocess from within a mod_perl handler.
I tried the example from the mod_perl site for the Apache2::SubProcess
module by using $r->spawn_proc_prog($prog,[EMAIL PROTECTED]);

Problem is I couldn't get it working fully. First thing I noticed, is
that using "/path/to/my/script.pl" doesn't work, because .pl scripts are
not directly executable like in linux distros and I get an OS error in
the apache log. If I just use 'c:\not_existing.exe' as $prog then
spawn_proc_prog throws another OS Error that the file
'c:\not_existing.exe' does not exist. So at spawn_proc_prog tries to do
something.

So I tried 'c:\perl\bin\perl.exe' as $prog and
'c:\Programme\ElserTextil\control\background_process.pl' as first
parameter. When doing this, no more errors were thrown, but the perl
program wasn't started either. I also experimented with the slashes, I
tried 'c:/perl/bin/perl.exe' and also 'C:\\perl\\bin\\perl.exe' but
nothing helped.

I also tried starting other programs like
'c:\WINDOWS\system32\notepad.exe' or '"c:\Programme\Microsoft
Office\Office11\Winword.exe"' with $prog, and also no errors were thrown
in the logfile, but none of the programs were started.

Can anyone please help me how to start a detached background process in
win32? I'm really out of ideas!

Thanks a lot

Marc





FYI: Building modperl in a separate build directory

2007-10-23 Thread Torsten Foertsch
Hi,

I have often the problem to switch between prefork and worker MPM. So I 
thought of using a separate build directory for each MPM while having a 
common source directory. This led to the attached script.

It creates 3 directories, mymodperl, mymodperl-worker, mymodperl-prefork, 
checks http://svn.apache.org/repos/asf/perl/modperl/trunk out to mymodperl 
and symlinks all files from mymodperl to mymodperl-worker and -prefork. Now 
you can in each of mymodperl-* run "perl Makefile.PL 
MP_APXS=/opt/apache22-worker/sbin/apxs ... && make test"

Files are changed in the mymodperl directory. When new files or directories 
are added just rerun the script.

Torsten


build-directory
Description: application/shellscript


signature.asc
Description: This is a digitally signed message part.


Migrating from mod_perl 1.x to mod_perl 2.x

2007-10-23 Thread Daniel Corbe
Hello,
We're trying to upgrade a web application from Apache 1.3.x to Apache
2.2.x(and thus from mod_perl
1.x to mod_perl 2.x) and we're having trouble with the basics at the moment:

[Tue Oct 23 17:42:12 2007] [error] [client 207.241.167.7] Can't locate
object method "method" via package "Apache2::RequestRec" at
/usr/local/billing/WCI/Router/FreeSWITCH.pm line 69.\n

The offending line:

   if ($request->method() eq "POST")


I did make sure Bundle::Apache2 was fully installed; however, no luck.

Can anyone point me to a good document on migrating?

Thanks.

-Daniel


Re: Migrating from mod_perl 1.x to mod_perl 2.x

2007-10-23 Thread adam . prime

http://perl.apache.org/docs/2.0/user/porting/porting.html

$r->method should be a part of Apache2::RequestRec though.  what  
version of mod_perl 2 are you using?


Adam

Quoting Daniel Corbe <[EMAIL PROTECTED]>:


Hello,
We're trying to upgrade a web application from Apache 1.3.x to Apache
2.2.x(and thus from mod_perl
1.x to mod_perl 2.x) and we're having trouble with the basics at the moment:

[Tue Oct 23 17:42:12 2007] [error] [client 207.241.167.7] Can't locate
object method "method" via package "Apache2::RequestRec" at
/usr/local/billing/WCI/Router/FreeSWITCH.pm line 69.\n

The offending line:

   if ($request->method() eq "POST")


I did make sure Bundle::Apache2 was fully installed; however, no luck.

Can anyone point me to a good document on migrating?

Thanks.

-Daniel







Re: Migrating from mod_perl 1.x to mod_perl 2.x

2007-10-23 Thread Daniel Corbe
drwxr-xr-x  15 mysql   wheel1024 Oct 23 16:22 mod_perl-2.0.3

On 10/23/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
> http://perl.apache.org/docs/2.0/user/porting/porting.html
>
> $r->method should be a part of Apache2::RequestRec though.  what
> version of mod_perl 2 are you using?
>
> Adam
>
>
> Quoting Daniel Corbe <[EMAIL PROTECTED]>:
>
> > Hello,
> > We're trying to upgrade a web application from Apache 1.3.x to Apache
> > 2.2.x(and thus from mod_perl
> > 1.x to mod_perl 2.x) and we're having trouble with the basics at the
> moment:
> >
> > [Tue Oct 23 17:42:12 2007] [error] [client 207.241.167.7] Can't locate
> > object method "method" via package "Apache2::RequestRec" at
> > /usr/local/billing/WCI/Router/FreeSWITCH.pm line 69.\n
> >
> > The offending line:
> >
> >if ($request->method() eq "POST")
> >
> >
> > I did make sure Bundle::Apache2 was fully installed; however, no luck.
> >
> > Can anyone point me to a good document on migrating?
> >
> > Thanks.
> >
> > -Daniel
> >
>
>
>
>


Re: FYI

2007-10-23 Thread Fred Moyer
There was a recent sytems upgrade which probably caused this.  Looking
into it.

> It's been broken at least a week.
>
> Quoting Bill Whillers <[EMAIL PROTECTED]>:
>
>> Maybe someones working?
>>
>> I'm just getting generic Internal Server Errors when searching on
>> anything
>> like "handler".
>>
>> http://perl.apache.org/search/swish.cgi?query=handler&sbm=&submit=search
>>
>>
>>
>>
>> On Monday 22 October 2007 16:47, Arshavir Grigorian wrote:
>>> Not sure if people already know about this, but running any search off
>>> of perl.apache.org gives a 500.
>>
>
>
>
>




Error during the installation of Apache??

2007-10-23 Thread Vishnu Mohanan
Hi Sir,
My name is Vishnu working as a Bioinformatics programmer in India. I
faced several problems in installation of mod_perl. I have installed Apache
httpd-2.2.6 in my local system. I installed Apache in the system using the
following commands

./configure --with-apxs=/usr/local/apache2/bin/apxs
make
make install

After that I tried to install mod_perl-2.0.3.
I gave the following command to install it.

[EMAIL PROTECTED] mod_perl-2.0.3]# perl Makefile.PL MP_APXS=
"/usr/local/apache2/bin/apxs"

But the result is only a error message as follows.

Reading Makefile.PL args from @ARGV
 MP_APXS = /usr/local/apache/bin/apxs
no conflicting prior mod_perl version found - good.
[  error] Unable to determine server version, aborting.
[  error] Invalid MP_APXS specified?

When I checked in the system, there is no folder named "APXS".
The APXS folder is not creating in the "/usr/local/apache2/bin/" directory.
I am using Fedora 5 version.
Is APXS is necessary? Then how will we create that?

Will you help me to install the mod_perl properly
Waiting for your reply..
Thanking you
  Yours faithfully
 Vishnu


Re: Migrating from mod_perl 1.x to mod_perl 2.x

2007-10-23 Thread Daniel Corbe
Well I threw a "use Apache2::compat" into the top of my file there, it runs
now.  I'll look at the rest of the proting guide later.
Thanks.

-daniel


On 10/23/07, Daniel Corbe <[EMAIL PROTECTED]> wrote:
>
> drwxr-xr-x  15 mysql   wheel1024 Oct 23 16:22 mod_perl-2.0.3
>
> On 10/23/07, [EMAIL PROTECTED] < [EMAIL PROTECTED]> wrote:
> >
> > http://perl.apache.org/docs/2.0/user/porting/porting.html
> >
> > $r->method should be a part of Apache2::RequestRec though.  what
> > version of mod_perl 2 are you using?
> >
> > Adam
> >
> >
> > Quoting Daniel Corbe < [EMAIL PROTECTED]>:
> >
> > > Hello,
> > > We're trying to upgrade a web application from Apache 1.3.x to Apache
> > > 2.2.x(and thus from mod_perl
> > > 1.x to mod_perl 2.x) and we're having trouble with the basics at the
> > moment:
> > >
> > > [Tue Oct 23 17:42:12 2007] [error] [client 207.241.167.7] Can't locate
> > > object method "method" via package "Apache2::RequestRec" at
> > > /usr/local/billing/WCI/Router/FreeSWITCH.pm line 69.\n
> > >
> > > The offending line:
> > >
> > >if ($request->method() eq "POST")
> > >
> > >
> > > I did make sure Bundle::Apache2 was fully installed; however, no luck.
> >
> > >
> > > Can anyone point me to a good document on migrating?
> > >
> > > Thanks.
> > >
> > > -Daniel
> > >
> >
> >
> >
> >
>


stringified enumeration

2007-10-23 Thread Will Fould
I realise this may not be the most appropriate list for this question:

I need to internally enumerate (delimit) href name/value pairs.

Is there are "standardly acceptable" way to do this?

http://www.example.com/?fruit::1=grape&fruit::2=apple&fruit::3=banana&color::1=purple&color::2=red&color::3=yellow

thank you in advance.

(w)


Re: stringified enumeration

2007-10-23 Thread Michael Peters
Will Fould wrote:
> I realise this may not be the most appropriate list for this question:
> 
> I need to internally enumerate (delimit) href name/value pairs.
> 
> Is there are "standardly acceptable" way to do this?
> 
> http://www.example.com/?fruit::1=grape&fruit::2=apple&fruit::3=banana&color::1=purple&color::2=red&color::3=yellow
> 

I've been using JSON recently for all my serialization needs. It would of course
need to be URL encoded.

I can't tell whether you're trying to get a structure like this:

{
  fruit : ['grape', 'apple', 'banana' ],
  color : ['purple', 'red', 'yellow' ]
}

or like this:

{
  grape  => 'purple',
  apple  => 'red',
  banana => 'yellow',
}

I'm assuming the latter. The JSON looks like this (generating this JSON is
really easy if you're using a modern JavaScript framework).

{
  grape : 'purple',
  apple : 'red',
  banana : 'yellow'
}

And the URL will look like
http://www.example.com?fruit=%7Bgrape%3A'purple'%2Capple%3A'red'%2Cbanana%3A'yellow'%7D

And then you can use JSON, or JSON::XS, JSON::Syck or whatever JSON module you
want from CPAN to deserialize it into a Perl structure on your server side.

-- 
Michael Peters
Developer
Plus Three, LP



Rose::DB and Apache::DBI

2007-10-23 Thread Arshavir Grigorian
Hi,

I just started using Rose::DB and have been experiencing certain
database connectivity issues.

DBD::Pg::st execute failed: ERROR:  prepared statement "dbdpg_1" already exists

My set up is as follows:

The box runs 2 Apache servers - one on port 80 and the other on port
8080. The former uses Class::DBI and Apache::DBI. The latter uses
Rose::DB and Apache::DBI. They both use the same database server, but
access different databases with different usernames. To isolate the
problem, I stopped the server running on port 80 but was still able to
recreate the problem.

package MSS::DB;

use base qw(Rose::DB);

# Use a private registry for this class
__PACKAGE__->use_private_registry;

# Register your lone data source using the default type and domain
__PACKAGE__->register_db(
 driver   => 'pg',
 database => 'mss_dev',
 username => 'mss_dev',
 password => '',
 );

package MSS::DB::Object;

use MSS::DB;

use base qw(Rose::DB::Object);

sub init_db { MSS::DB->new() }

1;

Also, in my main handler, I do

$r->pnotes( dbh  => MSS::DB->new->dbh );

and later use this db handle to access my session data through
Apache::Session::Postgres' tie() interface.

Thanks in advance for any comments/suggestions.

Arsh


Re: Rose::DB and Apache::DBI

2007-10-23 Thread John Siracusa
On 10/23/07, Arshavir Grigorian <[EMAIL PROTECTED]> wrote:
> I just started using Rose::DB and have been experiencing certain
> database connectivity issues.
>
> DBD::Pg::st execute failed: ERROR:  prepared statement "dbdpg_1" already 
> exists

A quick google turned up this page which offers a possible work-around:

http://people.planetpostgresql.org/greg/index.php?/archives/110-Using-DBDPg-with-pg_bouncer.html

Still, I think you should investigate until you find the actual
problem.  I've used RDBO wit DBD::Pg and Apache::DBI in the past and
haven't encountered this problem.

> Also, in my main handler, I do
>
> $r->pnotes(dbh => MSS::DB->new->dbh );

I've had some bad experiences with passing database handles around in
pnotes.  You might want to try temporarily replacing that with with a
global variable or something similarly tame just to see if it fixes
the problem.

Finally, I'll offer the init_db() implementation that I'm currently
using with Apache::DBI.  I don't think it will help your problem, but
then I don't really know what's causing it.

I suggest adding some debugging code until you completely understand
the lifecycle of database handles in your particular application.
Solutions to problems like these usually presents themselves clearly
once you see when and where database handles are created, cached,
reset, and destroyed.

-John

---

# An init_db() method for use with Apache::DBI

package My::DB;
use base 'Rose::DB';


package My::DB::Object;
use base 'Rose::DB::Object';
...
BEGIN:
{
  # Under mod_perl, cache the My::DB object, while letting Apache::DBI cache
  # the DBI $dbh it contains.  Preventing new My::DB objects from being
  # created then also prevents DBI->connect() from being called; though it
  # does not always cause a literal connect under Apache::DBI, it *does*
  # cause Apache::DBI to reset the $dbh to its initial state (arguably an
  # unwanted "feature" under mod_perl) and this will hose any extant
  # transactions on that handle if the initial state is AutoCommit => 1.
  if($ENV{'MOD_PERL'})
  {
our $DB;
*init_db = sub
{
  # Can't cache in the parent apache process
  if($Apache::Server::Starting)
  {
return My::DB->new;
  }
  else
  {
if($DB)
{
  $DB->dbh(undef); # will auto-reconnect as needed
  return $DB;
}
else
{
  return $DB = My::DB->new;
}
  }
};
  }
  else # act "normally" when not under mod_perl
  {
*init_db = sub { My::DB->new };
  }


Re: Rose::DB and Apache::DBI

2007-10-23 Thread Michael Peters
John Siracusa wrote:

>> Also, in my main handler, I do
>>
>> $r->pnotes(dbh => MSS::DB->new->dbh );
> 
> I've had some bad experiences with passing database handles around in
> pnotes.  You might want to try temporarily replacing that with with a
> global variable or something similarly tame just to see if it fixes
> the problem.

Why put a db handle in pnotes or a global at all? Apache::DBI will cache the
handles so if you have one connected it will be returned. If the connection
times out, Apache::DBI will manage that for you too. If you try and stash a DB
handle somewhere you'll end up having to re-implement what Apache::DBI does for
you automatically.

-- 
Michael Peters
Developer
Plus Three, LP



Re: Rose::DB and Apache::DBI

2007-10-23 Thread Perrin Harkins
On 10/23/07, John Siracusa <[EMAIL PROTECTED]> wrote:
> I've had some bad experiences with passing database handles around in
> pnotes.

It should be safe to do that.  One thing to remember is that pnotes
takes an alias to what you pass in, not a copy.  If you feed it $foo
and then change the value of $foo, the value in pnotes changes too.

- Perrin


activestate perl build 822 and modperl

2007-10-23 Thread Thomas
I have done some more test to nail down the problem with Activestate perl 5.8.8 
build 822 and modperl.

I have tested with the theoryx distribution of modperl and compiled everything 
from scratch (vc7).
Both have the same problems. 
When starting Apache with a reasonable amount of perl modules there is an 
exception error when the perlInterpStart parameter is set to more then 3 And 
even if it set to 3 the situation is not stable.

The error is:

  Unhandled exception at 0x77c16fa3 in httpd.exe: 0xC005: Access
violation reading location 0x03c17000.

On Windows 2003 the error is different.

No error/problems on Vista
No problems with Activestate build 820
And of course no problems running under Linux

Stactrace: 

msvcrt.dll!77c16fa3()   
perl58.dll!28056c2f()   
perl58.dll!2808705e()   
…….
perl58.dll!28089465()   
perl58.dll!2806b0c0()   
>   mod_perl.so!modperl_interp_new(modperl_interp_pool_t * mip=0x03c7ec50, 
> interpreter * perl=0x020a8244)  Line 92  C
mod_perl.so!interp_pool_grow(modperl_tipool_t * tipool=0x03c7ec60, void 
* data=0x03c7ec50)  Line 212 + 0x10 C
mod_perl.so!modperl_tipool_init(modperl_tipool_t * tipool=0x03c7ec60)  
Line 189 C
mod_perl.so!modperl_hook_post_config_last(apr_pool_t * 
pconf=0x0026bea8, apr_pool_t * plog=0x00920118, apr_pool_t * ptemp=0x008f6070, 
server_rec * s=0x0026ddd8)  Line 721 + 0x29   C
libhttpd.dll!6ff01e03() 
httpd.exe!0040177e()
ntdll.dll!7c9106eb()
httpd.exe!00401f82()
ntdll.dll!7c9106eb()
kernel32.dll!7c816fd7() 
ntdll.dll!7c9106eb()

Breakpoint at:

 PTR_TBL_t *source = modperl_module_config_table_get(perl, FALSE);

Apache Error_log:

[Tue Oct 23 22:59:01 2007] [notice] Apache/2.2.4 (Win32) 
mod_apreq2-20051231/2.6.0 mod_perl/2.0.3 Perl/v5.8.8 configured -- resuming 
normal operations
[Tue Oct 23 22:59:01 2007] [notice] Server built: Jan  9 2007 23:17:20
[Tue Oct 23 22:59:01 2007] [notice] Parent: Created child process 4492
[Tue Oct 23 22:59:14 2007] [crit] master_main: create child process failed. 
Exiting.
[Tue Oct 23 22:59:14 2007] [notice] Parent: Forcing termination of child 
process 36

The above is from a Windows XP SP2 machine with all windows patches applied.

Does this make sense ?

---

Thomas den Braber


<>

Re: Rose::DB and Apache::DBI

2007-10-23 Thread Arshavir Grigorian
On 10/23/07, Perrin Harkins <[EMAIL PROTECTED]> wrote:
> On 10/23/07, John Siracusa <[EMAIL PROTECTED]> wrote:
> > I've had some bad experiences with passing database handles around in
> > pnotes.
>
> It should be safe to do that.  One thing to remember is that pnotes
> takes an alias to what you pass in, not a copy.  If you feed it $foo
> and then change the value of $foo, the value in pnotes changes too.
>
> - Perrin
>

Thank you all for the comments. Replacing

$r->pnotes( dbh  => My::DB->new->dbh);

with

my $dbh = DBI->connect("dbi:Pg:dbname=dev", "dev", "");
$r->pnotes( dbh  => $dbh );

solved the issue. Doing connect_on_init() and still getting the dbh
from My::DB solves the issue as well (per Philip's suggestion). Does
Rose::DB bypass Apache::DBI if connect_on_init() hasn't been called?

Still not sure what exactly causes the issue in the first place though.

John, thanks for sharing your init_db() code. I guess the point of
caching the db handle in Rose::DB::Object in addition to the caching
done by Apache::DBI, is to ensure that all the Rose objects share the
same connection within each Apache child process. As you guessed,
using that code by itself (without the above fixes) didn't solve the
issue.


Re: Rose::DB and Apache::DBI

2007-10-23 Thread John Siracusa
On 10/23/07 5:17 PM, Perrin Harkins wrote:
> On 10/23/07, John Siracusa <[EMAIL PROTECTED]> wrote:
>> I've had some bad experiences with passing database handles around in
>> pnotes.
> 
> It should be safe to do that.  One thing to remember is that pnotes
> takes an alias to what you pass in, not a copy.  If you feed it $foo
> and then change the value of $foo, the value in pnotes changes too.

My problems were more along the lines of not realizing that an internal
subrequest was happening, which (if memory serves) would end up clearing
pnotes (or maybe my code was clearing/resetting pnotes when re-traversed for
the subrequest).  This was years ago, so maybe pnotes is better behaved
these days, but I've still tended to avoid that feature of MP1.

-John




Re: Rose::DB and Apache::DBI

2007-10-23 Thread John Siracusa
On 10/23/07 6:42 PM, Arshavir Grigorian wrote:
> Does Rose::DB bypass Apache::DBI if connect_on_init() hasn't been called?

Rose::DB just calls DBI in a straightforward manner.  It doesn't do anything
fancy.  (Also, it's surprisingly hard to "bypass" Apache::DBI; it's not
something that will happen by accident :)

-John 




Re: Migrating from mod_perl 1.x to mod_perl 2.x

2007-10-23 Thread Randy Kobes

On Tue, 23 Oct 2007, Daniel Corbe wrote:


Hello,
We're trying to upgrade a web application from Apache 1.3.x to Apache
2.2.x(and thus from mod_perl
1.x to mod_perl 2.x) and we're having trouble with the basics at the moment:

[Tue Oct 23 17:42:12 2007] [error] [client 207.241.167.7] Can't locate
object method "method" via package "Apache2::RequestRec" at
/usr/local/billing/WCI/Router/FreeSWITCH.pm line 69.\n

The offending line:

  if ($request->method() eq "POST")


For questions like these, the ModPerl::MethodLookup module
is quite useful:

  $ perl -MModPerl::MethodLookup -e print_method method
To use method 'method' add:
use Apache2::RequestRec ();

which indicates which module to use() in your script.

--
best regards,
Randy Kobes


Finding memory leaks

2007-10-23 Thread Chetan Sarva

Hey all,

We've got an aging web app running on Apache/1.3.34 (Ubuntu) and  
mod_perl/1.29 which we know has several memory leaks --- apache has  
been crashing of late and we'd like to stop that. For the time being  
we're using Apache::SizeLimit but would like to actually find and fix  
the root causes too :)


So far, the best tool I've found is Devel::Cycle but using it is hit  
or miss. I've applied it in some key spots where we know our data  
model has a parent-child relationship as well as some generic factory  
methods but actually finding circular refs is like a needle in a  
haystack. I've found and fixed 2 so far but am almost certain there  
are others there, lurking deep in the bowels.


Are there any better tools or more generic ways to attack this?

Chetan


Re: Error during the installation of Apache??

2007-10-23 Thread Torsten Foertsch
On Monday 22 October 2007, Vishnu Mohanan wrote:
> When I checked in the system, there is no folder named "APXS".
> The APXS folder is not creating in the "/usr/local/apache2/bin/" directory.
> I am using Fedora 5 version.
> Is APXS is necessary? Then how will we create that?

apxs is a program distributed with the apache web server to simplify module 
developement. mod_perl needs it to inquire configuration data like compiler 
flags, paths etc. It normally resides in the same directory as your http 
server. So look at the place where your http server is installed and you'll 
find an apxs program or just do:

find / -name apxs -type f -print

Torsten


signature.asc
Description: This is a digitally signed message part.