Processor ID with php

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • rob

    Processor ID with php

    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

    #2
    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]

    PHP is a popular general-purpose scripting language that powers everything from your blog to the most popular websites in the world.


    --
    MVH Jeppe Uhd - NX


    Comment

    • Kevin Thorpe

      #3
      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.

      Comment

      • Kevin Thorpe

        #4
        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.

        Comment

        • rob

          #5
          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.

          Comment

          • Kevin Thorpe

            #6
            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.

            Comment

            • .:Ninja

              #7
              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

              --

              Comment

              • rob

                #8
                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.

                Comment

                • rob

                  #9
                  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?

                  Comment

                  • Andy Hassall

                    #10
                    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

                    Comment

                    • rob

                      #11
                      Re: Processor ID with php

                      getmypid();

                      as simple as that

                      Comment

                      Working...