Hello, 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 serve this request (I am using MMP prefork). I would like to know and save the process ID of each process. I can see this by looking into the server-status page in Apache but I want to see 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();
To know and save the process ID of each request, I am thinking to find a way to run this script after each request.
1- Is this the best way to perform this task?
2- If yes, how can I make the script run after each request?
3- After I know the process ID, I want to write a C program to calculate the CPU usage of this process. Where should I save the process ID (in file, database, memcache ?) to be able to pass it to the C program?
run php script after each request
Moderator: General Moderators