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

2

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.

1

You can use lsof to find PID of the process accessing a certain file:

[rhusar@rhusar ~]$ ps xafu | grep cat
COMMAND  PID   USER   FD   TYPE DEVICE SIZE/OFF     NODE NAME
cat     5700 rhusar    1w   REG   0,29       57 13154551 /tmp/abc

However, if its logging via HTTPd itself, I would think you might only see the PID of the HTTPd instance.

  • Yes I know but it is not available -bash: lsof: command not found and I am not root. – Shlomo Aug 27 '13 at 11:01
  • lsof command is usually a separate package you need to have installed (e.g. lsof-4.87-2.fc19.x86_64 on current fedora). Get in touch with the admin and have it installed. – Radoslav H. Aug 27 '13 at 11:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.