Troubleshooting with strace

So recently I was trying to set-up a php-fpm & Nginx based server (with PHP 7 if I recall) and it would not run, I tried everything I could think of, having set up a few of these for work recently but it would just not work.

Well after much Googling I discovered a post on the Nginx forums not completely related to my troubles but it had a handy tip for debugging:

stop fpm
strace -efile /path/to/php-fpm -i > /dev/null

That command completely saved my sanity, for those who don’t know what it is (if anyone else actually reads this that is, and this is a lamens explanation) strace shows what in this case php-fpm gets up to and what files it tries to open. This led me to discover it was trying to open a particular file which was giving a permissions error I believe where it couldn’t open the file and quite shortly afterwards I was able to solve it.

If I didn’t discover that post and this command I would have given up and had a rather unproductive week I think. Well anyway here is the link to the post that originally helped me:
https://forum.nginx.org/read.php?3,148257,148272

Obviously if you run this for something else you just need to change the location of the binary, I was building php7 myself so pointed it to my own binary

If anyone else finds this useful then yay, glad I helped.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s