Hi, I have a multi-user web application installed on Linux working through Apache 2 and php 5. For each HTTP request, an Apache child process will be up to service this request (I am using MMP prefork). I would like to know and save the process ID of each process. Apache logs each request with some information by default. I can log the process ID of each request in Apache but I want to do this using php. In php, the function posix_getpid() returns the process ID but this returns different value when another process is up to serve different request (I noticed that by refreshing the script that contains the code: echo posix_getpid();
I want this in php because ultimately I want to report the number of sessions and information about each session (like start_time and end_time of the session, IP address, username, session ID and all the processes' IDs that belong to this session)
What is the best way to do this? for example, Is there a way to have my script that contains "echo posix_getpid();" refreshed for each request? or is there a way to read from Apache log file from php and to interpret this data?
Thank you