Step-by-step debugging with Xdebug is no secret for you? Perfect then, because we won’t talk about it. We will rather see tools that let you know what’s really happening in your PHP code, like the recent phpdbg debugger and phptrace, process tracing tools like: strace, ltrace, the Linux inotify mechanism, tcpdump/wireshark for network analysis,…
2. About me
● Patrick Allaert
● Founder of Libereco and co-founder of catchy.io
● Playing with PHP/Linux for +15 years
● eZ Publish core developer
● Author of the APM PHP extension
● @patrick_allaert
● patrickallaert@php.net
● http://github.com/patrickallaert/
● http://patrickallaert.blogspot.com/
9. Rubber duck debugging!
● You have an issue!
● Decide to bring it on Stack Overflow
● Write down your question
10. Rubber duck debugging!
● You have an issue!
● Decide to bring it on Stack Overflow
● Write down your question
● Realize that it doesn't make any sense
11. Rubber duck debugging!
● You have an issue!
● Decide to bring it on Stack Overflow
● Write down your question
● Realize that it doesn't make any sense
● Rethink how to ask it with enough information
12. Rubber duck debugging!
● You have an issue!
● Decide to bring it on Stack Overflow
● Write down your question
● Realize that it doesn't make any sense
● Rethink how to ask it with enough information
● Realize that you are attacking the problem from a
wrong perspective
13. Rubber duck debugging!
● You have an issue!
● Decide to bring it on Stack Overflow
● Write down your question
● Realize that it doesn't make any sense
● Rethink how to ask it with enough information
● Realize that you are attacking the problem from a
wrong perspective
● Start again from scratch and find your solution
30. strace
● Let's you trace any system calls done by a program
● $ strace <program to run>
● $ strace -p <pid> [-f]
● Use -e <category> to filter the type of syscall to
catch.
● Use -c for a summary of the system calls performed.
31. ltrace
● Let's you trace any library call
● Watch out, this might be very verbose!
● $ ltrace <program to run>
● $ ltrace -p <pid> [-f]
● Use -l <library> to filter on a specific library.
33. MySQL Proxy
● Sits between a client and a server and let's you do
what you want thanks to lua scripting.
● Examples:
● Printing:
– all queries
– the ones not using an index
– the slow ones
● Graphing the most frequent queries / used tables
● Simulate a heavy loaded (read:“slow”) DB
● https://github.com/patrickallaert/MySQL-Proxy-scripts-for-devs