0

I have started a PHP script via browser and due to a loop error the script continues to be executed even after closing the browser. I am noticing it since the script is logging error messages to my logfile (path known).

We have a Apache server where many developers work together and the user is nmdev. So how can I find out what process it the one running and logging to my logfile?

ps -afe | grep php53 gives me many processes of today like:

nmdev 26518 24151 0 11:51 ? 00:00:00 /opt/xxx/yyy/apache-php5/bin/httpd -k start

0

2 Answers 2

1

The tool lsof with the complete path of your file will give you a list of all processes which are accessing to it.

Example:

me@home ~ % lsof /home/me                                    
COMMAND     PID USER   FD   TYPE DEVICE SIZE/OFF    NODE NAME
i3bar      1894 me  cwd    DIR    8,3    32768 4718593 /home/me
j4status   1895 me  cwd    DIR    8,3    32768 4718593 /home/me
germinal   1899 me  cwd    DIR    8,3    32768 4718593 /home/me
3
  • Yes I know lsof but it is not available -bash: lsof: command not found and I am not root.
    – Shlomo
    Aug 27, 2013 at 11:01
  • Perhaps you should install it in this case...
    – etagenklo
    Aug 27, 2013 at 11:32
  • Ok, just saw you're NOT root. You'll have to be root (or at least be allowed to use sudo) in order to use lsof...
    – etagenklo
    Aug 27, 2013 at 11:33
0

The solution for my problem was to use:

/sbin/fuser /path/to/logfile

That gave me all the processes writing to the file. I killed them all without mercy. Problem solved.

Not the answer you're looking for? Browse other questions tagged .