Well, it has been days I am trying to fix an issue in one of my webapps using PHP with no luck so far:
Problem: The issue is occurring randomly and cannot be replicated at our will. I was able to find out the specific mysql query that is causing a change(this change is creating the issue) using mysql trigger. I need to find out from where(which line in PHP) this query is executing.
What I did: I checked all the files in the project to see the specific query and there are multiple instances. So I added email function on all these instances and waited for the issue to replicate. At last the issue replicated but I didn't get any email. I confirmed that the email sending code is working. So it seems I cannot trace it from project files.
What I like to do next: See if we can trace(preferably php debug_backtrace()) this specific query.(May be ways to attach to the function mysql_query
.)
Other info:
- This webapp is handed over to me a month ago and I do not know the entire logic of the project
- I cannot change the way the project use mysql as it is practically impossible because of huge number of files in the project.
- I am checking for sql injection, malicious code and suspicious POST requests to see if there are any foul play.
My QUESTION is: Is there a way to trace the php function mysql_query
like attaching another function after or before execution of mysql_query
?
Aucun commentaire:
Enregistrer un commentaire