How to find out what your wayward app is really doing
My friend has shown my the most awesome linux debugging tool. It’s a little tool called strace that shows you what function calls your wayward application is actually doing.
In my case, I couldn’t get Apache to see any directories that weren’t under DocumentRoot. So I started httpd using the strace program like this:
strace -f /sbin/service httpd start
And it gave me a listing of everything that happened when httpd started up.
Then I reproduced the action that was causing me problems (loading a page) and I (or.. err.. Vadim) could see where the problem was:
[pid 4085] read(8, "GET /helen/ HTTP/1.1rnHost: 80.4"..., 8000) = 407
[pid 4085] gettimeofday({1125159260, 481811}, NULL) = 0
[pid 4085] stat64("/home/www/helen", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
[pid 4085] stat64("/home/www/helen/index.html", 0xfeeabbe4) = -1 EACCES (Permission denied)
[pid 4085] lstat64("/home/www/helen", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
[pid 4085] lstat64("/home/www/helen/index.html", 0xfeeabbc4) = -1 EACCES (Permission denied)
Resolution: the ACL system I didn’t even know was installed on my box was preventing apache being able to access the directory.
