Skip to content

Instantly share code, notes, and snippets.

@ozh
Last active August 20, 2017 20:15
Show Gist options
  • Select an option

  • Save ozh/fe2bab6361cb981e3d7b0546be5424a4 to your computer and use it in GitHub Desktop.

Select an option

Save ozh/fe2bab6361cb981e3d7b0546be5424a4 to your computer and use it in GitHub Desktop.
Enable query log in YOURLS
<?php
// Needs YOURLS 1.7.3+ with PDO/AuraSQL
$sql = "SET GLOBAL log_output = 'FILE';";
$ydb->exec($sql);
$sql = "SET GLOBAL general_log_file = '/path/to/logfile.log';";
$ydb->exec($sql);
$sql = "SET GLOBAL general_log = 'ON';";
$ydb->exec($sql);
/*
For instance, shows that when:
$ydb->setAttribute(PDO::ATTR_EMULATE_PREPARES, false); (default is true)
the MySQL engine receive one query for prepare and one query for execute
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment