What SQL queries PHP scripts execute (without looking in the code)?
Another straight to the point solution
Sometimes I need to check what SQL queries is PHP script executing, but when code is quite complex (or encoded with Zend Guard or IonCube) it is extremely hard or even impossible to get this information from php files.So- here's a nice solution for this problem. It will log all the SQL queries send to the MySQL server in a MySQL table.
To enable logging execute this SQL queries in your MySQL database:
SET GLOBAL general_log = 'ON';
SET GLOBAL log_output = 'TABLE';
Now run your PHP code which does operations on MySQL database.Then execute this SQL queries to stop logging and print what has been logged so far:
SET GLOBAL general_log = 'OFF';
SELECT * FROM mysql.general_log;
Comments