Determine which PHP script executes a specific mysql query
Is it possible to开发者_如何学运维 know which PHP script is executing a certain mysql query?
I'm using a prebuilt system which has a bunch of files and I'm seeing one query I want to investigate but no idea where to start looking.
Thanks,
Try searching for non-variable parts of the query in the source files directly (e.g. using your IDE's search function, or using grep -r 'some part of the query'
).
If you can't find it, try tracing function calls with xdebug. This will log all PHP function calls, and it will be easy to find which file did mysql_query(the query).
(Set the ini setting xdebug.collect_params
to 3
to get the parameter values in the log file.)
精彩评论