Hello, I have phpmyadmin application where clients can use it to access Mysql. I have Apache2 web server (prefork module) installed on Linux machine. For each HTTP request from the clients, Apache assigns a child process to serve this request. I can see the PID of the processes in server-status file (http://localhost/server-status.html) but I would like to know how can I obtain the Apache process's id of each request as well as the user id (Mysql user) from php. (I mean how to write a php script to log the Mysql user and the PID of each request).
Thank you
Get Apache process's pid from php
Moderator: General Moderators
- John Cartwright
- Site Admin
- Posts: 11470
- Joined: Tue Dec 23, 2003 2:10 am
- Location: Toronto
- Contact:
Re: Get Apache process's pid from php
I'm not sure about the mysql user, however to acquire the pid you can simply use getmypid()
Re: Get Apache process's pid from php
I believe that getmypid() returns the process id of the php running script itself and not Apache processes' id.
Am I right?
Am I right?
-
Mark Baker
- Forum Regular
- Posts: 710
- Joined: Thu Oct 30, 2008 6:24 pm
Re: Get Apache process's pid from php
posix_getppid() will return the apache parent process
- John Cartwright
- Site Admin
- Posts: 11470
- Joined: Tue Dec 23, 2003 2:10 am
- Location: Toronto
- Contact:
Re: Get Apache process's pid from php
Thanks for the correction, Mark.