If the web server is running slow, is there a way to see which files are responsible?
Debian OS with Apache2 web server
Server Fault is a question and answer site for system and network administrators. It only takes a minute to sign up.Sign up to join this community
Have you considered using a profiler?
If you are trying to figure out which of your user's script is eating your resources, you could use the apache itk mpm, which runs vhosts under a user/group of your choice. Each request forks an apache process running as that user. Thus the ps/top output would show which user is running the script (and thus which vhost) - The downside is that itk is significantly slower of course. - Since with the normal prefork or worker mpm's apache handles multiple requests in one process for performance, it's harder to tell which requests are eating up your mojo.
If you're trying to find out exactly which functions in a php application are using up your resources, then you'll have to use xdebug. Obviously the xdebug profiling method would be a one time inspection for one php app, and not a solution for finding out which script belonging to which user in a shared hosting environment is consuming cpu time.
One thing I do, this is a bit inefficient, but I have a cron job run every minute which uses curl to save the output of
http://localhost/server-status to a file with the date and time as the filename. That way I can pull those files up in a web browser and see what URLs were being accessed at that moment in time. COmparing a number of these shows which scripts use the most resources. But it's not very accurate, it's just a quick and dirty way to see what's going on.
For an accurate representation, use a profiler as others have suggested.
Let me know if you'd like to see the cron job.