You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Adam Woodworth <mi...@gmail.com> on 2009/10/14 21:14:44 UTC

How can I get the Apache server number?

Say you're using the prefork MPM and you have 200 Apache children.  Is
there a way, within mod_perl, to find out what the server number is
for the apache child in which mod_perl is running?  Not the PID
number, but the server number (or whatever it's called) -- i.e., a
number between 1 and 200 that indicates which "slot" you're taking up
in the Apache list of children.

Thanks!
Adam

Re: How can I get the Apache server number?

Posted by Adam Woodworth <mi...@gmail.com>.
By looking at the apache source code, I've determined that the
connection->id is the server slot number when using the pre-fork MPM.
Yay!


On Sat, Oct 17, 2009 at 10:34 AM, Paul Silevitch <pa...@silevitch.com> wrote:
> I think the "id" method in Apache2::Connection module returns the slot
> number (starting at 0).  The documentation seems a little misleading
> (http://perl.apache.org/docs/2.0/api/Apache2/Connection.html#C_id_).  Anyone
> else ever use this method for this purpose?
> Thanks,
> Paul
>
> On Wed, Oct 14, 2009 at 3:14 PM, Adam Woodworth <mi...@gmail.com> wrote:
>>
>> Say you're using the prefork MPM and you have 200 Apache children.  Is
>> there a way, within mod_perl, to find out what the server number is
>> for the apache child in which mod_perl is running?  Not the PID
>> number, but the server number (or whatever it's called) -- i.e., a
>> number between 1 and 200 that indicates which "slot" you're taking up
>> in the Apache list of children.
>>
>> Thanks!
>> Adam
>
>