this could be a duplicate but I couldn't find the proper answer. Recently my server has been reporting high CPU usage and I want to find out what was causing that. When I used htop it showed me a bunch of apache2 processes so I guess one of my PHP scripts is probably being served however I would like to know which script exactly is causing that. Is there any way to do that? I'm running Ubuntu 14.04.

enter image description here

  • You should see apache logs it shows which php files are accessed Oct 13 '15 at 8:26
  • Apache logs are in /var/log/apache2/access.log Oct 13 '15 at 8:28

You should enable apache's server-status so you can see what is busy. You can see a live example output at apache.org.


You can use follow option with the tail command. eg.

tail -f /var/log/apache2/other_vhosts_access.log

Then you almost can see which files are served in realtime.

You can also tail -f the other relevant files in the same location:


You could also get a more detailed realtime view from the command line via goaccess.


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.