$ strace php tias.php -e open,access 2>&1 | grep foo.txt Sometimes a program refuses to read a file and you\’re not sure why. You may have display_errors turned off for PHP or something. In this example, fopen(\’/var/www/test/foo.txt\’) was called but doesn\’t have read access to foo.txt.
Strace can tell you what went wrong. E.g., if php doesn\’t have read access to the file, strace will say \”EACCESS (Permission denied)\”. Or, if the file path you gave doesn\’t exist, strace will say \”ENOENT (No such file or directory)\”, etc.
This works for any program you can run from the command-line, e.g., strace python myapp.py -e open,access…
by David Winterbottom (codeinthehole.com)
Related articles by Zemanta
- Visualizing system performance data (amit-agarwal.co.in)
- IO profiling of MPI apps (insidehpc.com)
- Symfony Components (slideshare.net)
- What Every Developer Should Know About URLs (skorks.com)
- Creating MySQL Stored Routines for Non-DBAs – Part Three (helpdeskgeek.com)