Using strace to analyze apache

For times that you want to know exactly what a process is doing (for instance, if your apache is Pleskified and you’re getting weird website errors that can’t be traced back to any of your own code…) you can use strace.

 service apache2 stop

strace -f -o trace.txt /etc/init.d/apache2 start  # this will run strace on all child processes of apache, so you don't need to worry about figuring out the correct process

## do whatever to generate the error message (in my case, just accessing the site)

service apache2 stop

## use htop to verify the strace has stopped

service apache2 start
 

Then check trace.txt to find your issue!

And have a look here for a more thorough tutorial.

Leave a Reply

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

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>