Connecting Tech Pros Worldwide Forums | Help | Site Map

Processor ID with php

rob
Guest
 
Posts: n/a
#1: Jul 17 '05
How is it possible to find the processor id of the current web
connection that a user has made, so that it can be displayed onto the
page.

is the "PID" that is assigned to each process item, (from doing ps
-ax) would display them all, but not sure how to display the current
one using php.

I know there is a way of doing it with PERL but not sure if there is
with PHP.

Any replies would be appreciated.

Jeppe Uhd
Guest
 
Posts: n/a
#2: Jul 17 '05

re: Processor ID with php


rob wrote:[color=blue]
> How is it possible to find the processor id of the current web
> connection that a user has made, so that it can be displayed onto the
> page.
>
> is the "PID" that is assigned to each process item, (from doing ps
> -ax) would display them all, but not sure how to display the current
> one using php.
>
> I know there is a way of doing it with PERL but not sure if there is
> with PHP.
>
> Any replies would be appreciated.[/color]

http://dk.php.net/manual/en/function.getmypid.php

--
MVH Jeppe Uhd - NX


Kevin Thorpe
Guest
 
Posts: n/a
#3: Jul 17 '05

re: Processor ID with php


rob wrote:[color=blue]
> How is it possible to find the processor id of the current web
> connection that a user has made, so that it can be displayed onto the
> page.
>
> is the "PID" that is assigned to each process item, (from doing ps
> -ax) would display them all, but not sure how to display the current
> one using php.
>
> I know there is a way of doing it with PERL but not sure if there is
> with PHP.[/color]

It doesn't look like it. phpinfo() tells me nothing. What do you want it
for? You have to bear in mind that it may only be valid for a single
page load as the next request may be sent to a fresh apache child.
Kevin Thorpe
Guest
 
Posts: n/a
#4: Jul 17 '05

re: Processor ID with php


>[color=blue]
> http://dk.php.net/manual/en/function.getmypid.php
>[/color]
oops. Didn't see that. I sort of assumed that it would be in the
environment somewhere.

My point about it possibly not being valid between pages still stands
though.
rob
Guest
 
Posts: n/a
#5: Jul 17 '05

re: Processor ID with php


> It doesn't look like it. phpinfo() tells me nothing. What do you want it[color=blue]
> for? You have to bear in mind that it may only be valid for a single
> page load as the next request may be sent to a fresh apache child.[/color]


I want it for creating a "session id" unique to that user, based on
the time the pid was issues and the pid itself, so that the session id
can be as small a value as possible but still unique.
Kevin Thorpe
Guest
 
Posts: n/a
#6: Jul 17 '05

re: Processor ID with php


rob wrote:[color=blue][color=green]
>>It doesn't look like it. phpinfo() tells me nothing. What do you want it
>>for? You have to bear in mind that it may only be valid for a single
>>page load as the next request may be sent to a fresh apache child.[/color]
>
>
>
> I want it for creating a "session id" unique to that user, based on
> the time the pid was issues and the pid itself, so that the session id
> can be as small a value as possible but still unique.[/color]

In that case why not use sessions? If you use session_start() at the top
of your pages then a unique session id will be gewnerated for you.
.:Ninja
Guest
 
Posts: n/a
#7: Jul 17 '05

re: Processor ID with php


rob wrote:[color=blue]
> I want it for creating a "session id" unique to that user, based on
> the time the pid was issues and the pid itself, so that the session id
> can be as small a value as possible but still unique.[/color]

You can still create such an ID using a more static parameter - such as the
user's IP address. I've done this before, created a unique identifying
string for each visiting user by crypt()-ing the IP address using the
person's browser identifier as seed. Then chuck that into a database and as
soon as the user returns from the same IP using the same browser, you'll
know they've been there before because the same encrypted string will be
generated again and you can check for its existence in the database. Or
easier - use sessions =)

Albe

--
http://www.ninja.up.ac.za
rob
Guest
 
Posts: n/a
#8: Jul 17 '05

re: Processor ID with php


> In that case why not use sessions? If you use session_start() at the top[color=blue]
> of your pages then a unique session id will be gewnerated for you.[/color]

I am trying another, shorter method. session id's are too long. And
want to be able to find out the pid for a new method.
rob
Guest
 
Posts: n/a
#9: Jul 17 '05

re: Processor ID with php


> You can still create such an ID using a more static parameter - such as the[color=blue]
> user's IP address. I've done this before, created a unique identifying
> string for each visiting user by crypt()-ing the IP address using the
> person's browser identifier as seed. Then chuck that into a database and as
> soon as the user returns from the same IP using the same browser, you'll
> know they've been there before because the same encrypted string will be
> generated again and you can check for its existence in the database. Or
> easier - use sessions =)
>
> Albe[/color]

This still has possible problems, what if you are going through a
caching server, or you are sharing an IP with someone with the same
browser version.

Doing it the way with a pid is a guarenteed method, relying on an IP
or browser agent can have flaws. So really just want to know if it is
possible to get the pid, anyone know?
Andy Hassall
Guest
 
Posts: n/a
#10: Jul 17 '05

re: Processor ID with php


On 24 Mar 2004 00:51:57 -0800, rob@cdli.co.uk (rob) wrote:
[color=blue][color=green]
>> In that case why not use sessions? If you use session_start() at the top
>> of your pages then a unique session id will be gewnerated for you.[/color]
>
>I am trying another, shorter method. session id's are too long. And
>want to be able to find out the pid for a new method.[/color]

Too long for what?

--
Andy Hassall <andy@andyh.co.uk> / Space: disk usage analysis tool
http://www.andyh.co.uk / http://www.andyhsoftware.co.uk/space
rob
Guest
 
Posts: n/a
#11: Jul 17 '05

re: Processor ID with php


getmypid();

as simple as that
Closed Thread