Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 

README.md

Web stack debugging #3

This project about more Web stack debugging cases.

Summary

I learnt about tmux and strace and how to use them to debug web applications. These are the steps I took for the project.

  • Start the tmux session: tmux
  • List Apache Processes (parent/child): ps aux | grep apache
  • Attach strace to "the" Apache Process: sudo strace -p <PID>
  • Trigger the 500 Error:
    • split tmux into two panes: C-b %
    • on the new pane, use curl to Trigger the Error: curl -sI 127.0.0.1
  • Analyze the strace Output:
    • look for error messages or failed system calls
    • in this case, error: No such file or directory related to a .phpp file, a typo
  • Search for the files containing the typo error: grep -ro "phpp" <PATH>
root@07778635a2a2:/# grep -ro "phpp" /var/www/html            
/var/www/html/wp-includes/js/zxcvbn.min.js:phpp
/var/www/html/wp-includes/js/zxcvbn.min.js:phpp
/var/www/html/wp-includes/js/zxcvbn.min.js:phpp
/var/www/html/wp-includes/js/zxcvbn.min.js:phpp
/var/www/html/wp-includes/js/zxcvbn.min.js:phpp
/var/www/html/wp-includes/js/zxcvbn.min.js:phpp
/var/www/html/wp-settings.php:phpp
root@07778635a2a2:/#
  • Inspect "the" file and fix the typo occurence(s):
    • search for the line number(s) containing the typo: grep -n "phpp" <PATH>
    • open the file and make the necessary correction. (from .phpp to .php)
  • write puppet manifest to fix the typo error: 0-strace_is_your_friend.pp

Here's a video I watched, that's on how strace can be used to debug an applications. YouTube

Files

Each file contains the solution to a task in the project.

  • 0-strace_is_your_friend.pp: Using strace, find out why Apache is returning a 500 error. Once you find the issue, fix it and then automate it using Puppet (instead of using Bash as you were previously doing).