Apache Cpanel Linux PHP

Linux find php file by process id

Sometimes on dedicated hosting there can be some scripts which will start consuming 100% of CPU and all the websites will stop working.

We can find out process list using this command:

top -i

It will tell us the process id, but still we won’t be able to find out which php file might have created this process.

sudo lsof -p PID(process id which is taking up cpu)

This will show list of files which are using this particular process. And anything matching your apache root directory (mostly /var/www/html/….) is the culprit.

** you might need to install lsof using :

sudo apt-get install lsof

Related article:

Leave a Reply

Your email address will not be published. Required fields are marked *