Merge branch 'QA_3_4'
[phpmyadmin.git] / server_status.php
blob4a8a37f8a6f1d03806d0a1c8a5d8a31711c995f8
1 <?php
2 /* vim: set expandtab sw=4 ts=4 sts=4: */
3 /**
4 * displays status variables with descriptions and some hints an optmizing
5 * + reset status variables
7 * @package phpMyAdmin
8 */
10 /**
11 * no need for variables importing
12 * @ignore
14 if (! defined('PMA_NO_VARIABLES_IMPORT')) {
15 define('PMA_NO_VARIABLES_IMPORT', true);
18 if (isset($_REQUEST['ajax_request']) && $_REQUEST['ajax_request'] == true) {
19 $GLOBALS['is_header_sent'] = true;
22 require_once './libraries/common.inc.php';
24 /**
25 * Ajax request
28 if (isset($_REQUEST['ajax_request']) && $_REQUEST['ajax_request'] == true) {
29 // Send with correct charset
30 header('Content-Type: text/html; charset=UTF-8');
32 // real-time charting data
33 if (isset($_REQUEST['chart_data'])) {
34 switch($_REQUEST['type']) {
35 // Process and Connections realtime chart
36 case 'proc':
37 $c = PMA_DBI_fetch_result("SHOW GLOBAL STATUS WHERE Variable_name = 'Connections'", 0, 1);
38 $result = PMA_DBI_query('SHOW PROCESSLIST');
39 $num_procs = PMA_DBI_num_rows($result);
41 $ret = array(
42 'x' => microtime(true) * 1000,
43 'y_proc' => $num_procs,
44 'y_conn' => $c['Connections']
47 exit(json_encode($ret));
49 // Query realtime chart
50 case 'queries':
51 if (PMA_DRIZZLE) {
52 $sql = "SELECT concat('Com_', variable_name), variable_value
53 FROM data_dictionary.GLOBAL_STATEMENTS
54 WHERE variable_value > 0
55 UNION
56 SELECT variable_name, variable_value
57 FROM data_dictionary.GLOBAL_STATUS
58 WHERE variable_name = 'Questions'";
59 $queries = PMA_DBI_fetch_result($sql, 0, 1);
60 } else {
61 $queries = PMA_DBI_fetch_result(
62 "SHOW GLOBAL STATUS
63 WHERE (Variable_name LIKE 'Com_%' OR Variable_name = 'Questions')
64 AND Value > 0", 0, 1);
66 cleanDeprecated($queries);
67 // admin commands are not queries
68 unset($queries['Com_admin_commands']);
69 $questions = $queries['Questions'];
70 unset($queries['Questions']);
72 //$sum=array_sum($queries);
73 $ret = array(
74 'x' => microtime(true) * 1000,
75 'y' => $questions,
76 'pointInfo' => $queries
79 exit(json_encode($ret));
81 // Traffic realtime chart
82 case 'traffic':
83 $traffic = PMA_DBI_fetch_result(
84 "SHOW GLOBAL STATUS
85 WHERE Variable_name = 'Bytes_received'
86 OR Variable_name = 'Bytes_sent'", 0, 1);
88 $ret = array(
89 'x' => microtime(true) * 1000,
90 'y_sent' => $traffic['Bytes_sent'],
91 'y_received' => $traffic['Bytes_received']
94 exit(json_encode($ret));
96 // Data for the monitor
97 case 'chartgrid':
98 $ret = json_decode($_REQUEST['requiredData'], true);
99 $statusVars = array();
100 $serverVars = array();
101 $sysinfo = $cpuload = $memory = 0;
102 $pName = '';
104 /* Accumulate all required variables and data */
105 // For each chart
106 foreach ($ret as $chart_id => $chartNodes) {
107 // For each data series
108 foreach ($chartNodes as $node_id => $nodeDataPoints) {
109 // For each data point in the series (usually just 1)
110 foreach ($nodeDataPoints as $point_id => $dataPoint) {
111 $pName = $dataPoint['name'];
113 switch ($dataPoint['type']) {
114 /* We only collect the status and server variables here to
115 * read them all in one query, and only afterwards assign them.
116 * Also do some white list filtering on the names
118 case 'servervar':
119 if (!preg_match('/[^a-zA-Z_]+/', $pName)) {
120 $serverVars[] = $pName;
122 break;
124 case 'statusvar':
125 if (!preg_match('/[^a-zA-Z_]+/', $pName)) {
126 $statusVars[] = $pName;
128 break;
130 case 'proc':
131 $result = PMA_DBI_query('SHOW PROCESSLIST');
132 $ret[$chart_id][$node_id][$point_id]['value'] = PMA_DBI_num_rows($result);
133 break;
135 case 'cpu':
136 if (!$sysinfo) {
137 include_once 'libraries/sysinfo.lib.php';
138 $sysinfo = getSysInfo();
140 if (!$cpuload) {
141 $cpuload = $sysinfo->loadavg();
144 if (PHP_OS == 'Linux') {
145 $ret[$chart_id][$node_id][$point_id]['idle'] = $cpuload['idle'];
146 $ret[$chart_id][$node_id][$point_id]['busy'] = $cpuload['busy'];
147 } else
148 $ret[$chart_id][$node_id][$point_id]['value'] = $cpuload['loadavg'];
150 break;
152 case 'memory':
153 if (!$sysinfo) {
154 include_once 'libraries/sysinfo.lib.php';
155 $sysinfo = getSysInfo();
157 if (!$memory) {
158 $memory = $sysinfo->memory();
161 $ret[$chart_id][$node_id][$point_id]['value'] = $memory[$pName];
162 break;
163 } /* switch */
164 } /* foreach */
165 } /* foreach */
166 } /* foreach */
168 // Retrieve all required status variables
169 if (count($statusVars)) {
170 $statusVarValues = PMA_DBI_fetch_result(
171 "SHOW GLOBAL STATUS
172 WHERE Variable_name='" . implode("' OR Variable_name='", $statusVars) . "'", 0, 1);
173 } else {
174 $statusVarValues = array();
177 // Retrieve all required server variables
178 if (count($serverVars)) {
179 $serverVarValues = PMA_DBI_fetch_result(
180 "SHOW GLOBAL VARIABLES
181 WHERE Variable_name='" . implode("' OR Variable_name='", $serverVars) . "'", 0, 1);
182 } else {
183 $serverVarValues = array();
186 // ...and now assign them
187 foreach ($ret as $chart_id => $chartNodes) {
188 foreach ($chartNodes as $node_id => $nodeDataPoints) {
189 foreach ($nodeDataPoints as $point_id => $dataPoint) {
190 switch($dataPoint['type']) {
191 case 'statusvar':
192 $ret[$chart_id][$node_id][$point_id]['value'] = $statusVarValues[$dataPoint['name']];
193 break;
194 case 'servervar':
195 $ret[$chart_id][$node_id][$point_id]['value'] = $serverVarValues[$dataPoint['name']];
196 break;
202 $ret['x'] = microtime(true) * 1000;
204 exit(json_encode($ret));
208 if (isset($_REQUEST['log_data'])) {
209 if (PMA_MYSQL_INT_VERSION < 50106) {
210 /* FIXME: why this? */
211 exit('""');
214 $start = intval($_REQUEST['time_start']);
215 $end = intval($_REQUEST['time_end']);
217 if ($_REQUEST['type'] == 'slow') {
218 $q = 'SELECT start_time, user_host, Sec_to_Time(Sum(Time_to_Sec(query_time))) as query_time, Sec_to_Time(Sum(Time_to_Sec(lock_time))) as lock_time, '.
219 'SUM(rows_sent) AS rows_sent, SUM(rows_examined) AS rows_examined, db, sql_text, COUNT(sql_text) AS \'#\' '.
220 'FROM `mysql`.`slow_log` WHERE start_time > FROM_UNIXTIME(' . $start . ') '.
221 'AND start_time < FROM_UNIXTIME(' . $end . ') GROUP BY sql_text';
223 $result = PMA_DBI_try_query($q);
225 $return = array('rows' => array(), 'sum' => array());
226 $type = '';
228 while ($row = PMA_DBI_fetch_assoc($result)) {
229 $type = strtolower(substr($row['sql_text'], 0, strpos($row['sql_text'], ' ')));
231 switch($type) {
232 case 'insert':
233 case 'update':
234 // Cut off big inserts and updates, but append byte count therefor
235 if (strlen($row['sql_text']) > 220) {
236 $row['sql_text'] = substr($row['sql_text'], 0, 200)
237 . '... ['
238 . implode(' ', PMA_formatByteDown(strlen($row['sql_text']), 2, 2))
239 . ']';
241 break;
242 default:
243 break;
246 if (!isset($return['sum'][$type])) {
247 $return['sum'][$type] = 0;
249 $return['sum'][$type] += $row['#'];
250 $return['rows'][] = $row;
253 $return['sum']['TOTAL'] = array_sum($return['sum']);
254 $return['numRows'] = count($return['rows']);
256 PMA_DBI_free_result($result);
258 exit(json_encode($return));
261 if ($_REQUEST['type'] == 'general') {
262 $limitTypes = (isset($_REQUEST['limitTypes']) && $_REQUEST['limitTypes'])
263 ? 'AND argument REGEXP \'^(INSERT|SELECT|UPDATE|DELETE)\' ' : '';
265 $q = 'SELECT TIME(event_time) as event_time, user_host, thread_id, server_id, argument, count(argument) as \'#\' '.
266 'FROM `mysql`.`general_log` WHERE command_type=\'Query\' '.
267 'AND event_time > FROM_UNIXTIME(' . $start . ') AND event_time < FROM_UNIXTIME(' . $end . ') '.
268 $limitTypes . 'GROUP by argument'; // HAVING count > 1';
270 $result = PMA_DBI_try_query($q);
272 $return = array('rows' => array(), 'sum' => array());
273 $type = '';
274 $insertTables = array();
275 $insertTablesFirst = -1;
276 $i = 0;
277 $removeVars = isset($_REQUEST['removeVariables']) && $_REQUEST['removeVariables'];
279 while ($row = PMA_DBI_fetch_assoc($result)) {
280 preg_match('/^(\w+)\s/', $row['argument'], $match);
281 $type = strtolower($match[1]);
283 if (!isset($return['sum'][$type])) {
284 $return['sum'][$type] = 0;
286 $return['sum'][$type] += $row['#'];
288 switch($type) {
289 case 'insert':
290 // Group inserts if selected
291 if ($removeVars && preg_match('/^INSERT INTO (`|\'|"|)([^\s\\1]+)\\1/i', $row['argument'], $matches)) {
292 $insertTables[$matches[2]]++;
293 if ($insertTables[$matches[2]] > 1) {
294 $return['rows'][$insertTablesFirst]['#'] = $insertTables[$matches[2]];
296 // Add a ... to the end of this query to indicate that there's been other queries
297 if ($return['rows'][$insertTablesFirst]['argument'][strlen($return['rows'][$insertTablesFirst]['argument'])-1] != '.') {
298 $return['rows'][$insertTablesFirst]['argument'] .= '<br/>...';
301 // Group this value, thus do not add to the result list
302 continue 2;
303 } else {
304 $insertTablesFirst = $i;
305 $insertTables[$matches[2]] += $row['#'] - 1;
308 // No break here
310 case 'update':
311 // Cut off big inserts and updates, but append byte count therefor
312 if (strlen($row['argument']) > 220) {
313 $row['argument'] = substr($row['argument'], 0, 200)
314 . '... ['
315 . implode(' ', PMA_formatByteDown(strlen($row['argument'])), 2, 2)
316 . ']';
318 break;
320 default: break;
323 $return['rows'][] = $row;
324 $i++;
327 $return['sum']['TOTAL'] = array_sum($return['sum']);
328 $return['numRows'] = count($return['rows']);
330 PMA_DBI_free_result($result);
332 exit(json_encode($return));
336 if (isset($_REQUEST['logging_vars'])) {
337 if (isset($_REQUEST['varName']) && isset($_REQUEST['varValue'])) {
338 $value = PMA_sqlAddslashes($_REQUEST['varValue']);
339 if (!is_numeric($value)) {
340 $value="'" . $value . "'";
343 if (! preg_match("/[^a-zA-Z0-9_]+/", $_REQUEST['varName'])) {
344 PMA_DBI_query('SET GLOBAL ' . $_REQUEST['varName'] . ' = ' . $value);
349 $loggingVars = PMA_DBI_fetch_result('SHOW GLOBAL VARIABLES WHERE Variable_name IN ("general_log","slow_query_log","long_query_time","log_output")', 0, 1);
350 exit(json_encode($loggingVars));
353 if (isset($_REQUEST['query_analyzer'])) {
354 $return = array();
356 if (strlen($_REQUEST['database'])) {
357 PMA_DBI_select_db($_REQUEST['database']);
360 if ($profiling = PMA_profilingSupported()) {
361 PMA_DBI_query('SET PROFILING=1;');
364 // Do not cache query
365 $query = preg_replace('/^(\s*SELECT)/i', '\\1 SQL_NO_CACHE', $_REQUEST['query']);
367 $result = PMA_DBI_try_query($query);
368 $return['affectedRows'] = $GLOBALS['cached_affected_rows'];
370 $result = PMA_DBI_try_query('EXPLAIN ' . $query);
371 while ($row = PMA_DBI_fetch_assoc($result)) {
372 $return['explain'][] = $row;
375 // In case an error happened
376 $return['error'] = PMA_DBI_getError();
378 PMA_DBI_free_result($result);
380 if ($profiling) {
381 $return['profiling'] = array();
382 $result = PMA_DBI_try_query('SELECT seq,state,duration FROM INFORMATION_SCHEMA.PROFILING WHERE QUERY_ID=1 ORDER BY seq');
383 while ($row = PMA_DBI_fetch_assoc($result)) {
384 $return['profiling'][]= $row;
386 PMA_DBI_free_result($result);
389 exit(json_encode($return));
392 if (isset($_REQUEST['advisor'])) {
393 include 'libraries/Advisor.class.php';
394 $advisor = new Advisor();
395 exit(json_encode($advisor->run()));
401 * Replication library
403 if (PMA_DRIZZLE) {
404 $server_master_status = false;
405 $server_slave_status = false;
406 } else {
407 include './libraries/replication.inc.php';
408 include_once './libraries/replication_gui.lib.php';
412 * JS Includes
415 $GLOBALS['js_include'][] = 'server_status.js';
416 $GLOBALS['js_include'][] = 'jquery/jquery-ui-1.8.custom.js';
417 $GLOBALS['js_include'][] = 'jquery/jquery.tablesorter.js';
418 $GLOBALS['js_include'][] = 'jquery/jquery.cookie.js'; // For tab persistence
419 // Charting
420 $GLOBALS['js_include'][] = 'highcharts/highcharts.js';
421 /* Files required for chart exporting */
422 $GLOBALS['js_include'][] = 'highcharts/exporting.js';
423 /* < IE 9 doesn't support canvas natively */
424 if(PMA_USR_BROWSER_AGENT == 'IE' && PMA_USR_BROWSER_VER < 9) {
425 $GLOBALS['js_include'][] = 'canvg/flashcanvas.js';
427 $GLOBALS['js_include'][] = 'canvg/canvg.js';
430 * flush status variables if requested
432 if (isset($_REQUEST['flush'])) {
433 $_flush_commands = array(
434 'STATUS',
435 'TABLES',
436 'QUERY CACHE',
439 if (in_array($_REQUEST['flush'], $_flush_commands)) {
440 PMA_DBI_query('FLUSH ' . $_REQUEST['flush'] . ';');
442 unset($_flush_commands);
446 * Kills a selected process
448 if (!empty($_REQUEST['kill'])) {
449 if (PMA_DBI_try_query('KILL ' . $_REQUEST['kill'] . ';')) {
450 $message = PMA_Message::success(__('Thread %s was successfully killed.'));
451 } else {
452 $message = PMA_Message::error(__('phpMyAdmin was unable to kill thread %s. It probably has already been closed.'));
454 $message->addParam($_REQUEST['kill']);
455 //$message->display();
461 * get status from server
463 $server_status = PMA_DBI_fetch_result('SHOW GLOBAL STATUS', 0, 1);
464 if (PMA_DRIZZLE) {
465 // Drizzle doesn't put query statistics into variables, add it
466 $sql = "SELECT concat('Com_', variable_name), variable_value
467 FROM data_dictionary.GLOBAL_STATEMENTS";
468 $statements = PMA_DBI_fetch_result($sql, 0, 1);
469 $server_status = array_merge($server_status, $statements);
473 * for some calculations we require also some server settings
475 $server_variables = PMA_DBI_fetch_result('SHOW GLOBAL VARIABLES', 0, 1);
478 * cleanup of some deprecated values
480 cleanDeprecated($server_status);
483 * calculate some values
485 // Key_buffer_fraction
486 if (isset($server_status['Key_blocks_unused'])
487 && isset($server_variables['key_cache_block_size'])
488 && isset($server_variables['key_buffer_size'])) {
489 $server_status['Key_buffer_fraction_%'] =
491 - $server_status['Key_blocks_unused']
492 * $server_variables['key_cache_block_size']
493 / $server_variables['key_buffer_size']
494 * 100;
495 } elseif (isset($server_status['Key_blocks_used'])
496 && isset($server_variables['key_buffer_size'])) {
497 $server_status['Key_buffer_fraction_%'] =
498 $server_status['Key_blocks_used']
499 * 1024
500 / $server_variables['key_buffer_size'];
503 // Ratio for key read/write
504 if (isset($server_status['Key_writes'])
505 && isset($server_status['Key_write_requests'])
506 && $server_status['Key_write_requests'] > 0) {
507 $server_status['Key_write_ratio_%'] = 100 * $server_status['Key_writes'] / $server_status['Key_write_requests'];
510 if (isset($server_status['Key_reads'])
511 && isset($server_status['Key_read_requests'])
512 && $server_status['Key_read_requests'] > 0) {
513 $server_status['Key_read_ratio_%'] = 100 * $server_status['Key_reads'] / $server_status['Key_read_requests'];
516 // Threads_cache_hitrate
517 if (isset($server_status['Threads_created'])
518 && isset($server_status['Connections'])
519 && $server_status['Connections'] > 0) {
521 $server_status['Threads_cache_hitrate_%'] =
522 100 - $server_status['Threads_created'] / $server_status['Connections'] * 100;
526 * split variables in sections
528 $allocations = array(
529 // variable name => section
530 // variable names match when they begin with the given string
532 'Com_' => 'com',
533 'Innodb_' => 'innodb',
534 'Ndb_' => 'ndb',
535 'Handler_' => 'handler',
536 'Qcache_' => 'qcache',
537 'Threads_' => 'threads',
538 'Slow_launch_threads' => 'threads',
540 'Binlog_cache_' => 'binlog_cache',
541 'Created_tmp_' => 'created_tmp',
542 'Key_' => 'key',
544 'Delayed_' => 'delayed',
545 'Not_flushed_delayed_rows' => 'delayed',
547 'Flush_commands' => 'query',
548 'Last_query_cost' => 'query',
549 'Slow_queries' => 'query',
550 'Queries' => 'query',
551 'Prepared_stmt_count' => 'query',
553 'Select_' => 'select',
554 'Sort_' => 'sort',
556 'Open_tables' => 'table',
557 'Opened_tables' => 'table',
558 'Open_table_definitions' => 'table',
559 'Opened_table_definitions' => 'table',
560 'Table_locks_' => 'table',
562 'Rpl_status' => 'repl',
563 'Slave_' => 'repl',
565 'Tc_' => 'tc',
567 'Ssl_' => 'ssl',
569 'Open_files' => 'files',
570 'Open_streams' => 'files',
571 'Opened_files' => 'files',
574 $sections = array(
575 // section => section name (description)
576 'com' => 'Com',
577 'query' => __('SQL query'),
578 'innodb' => 'InnoDB',
579 'ndb' => 'NDB',
580 'handler' => __('Handler'),
581 'qcache' => __('Query cache'),
582 'threads' => __('Threads'),
583 'binlog_cache' => __('Binary log'),
584 'created_tmp' => __('Temporary data'),
585 'delayed' => __('Delayed inserts'),
586 'key' => __('Key cache'),
587 'select' => __('Joins'),
588 'repl' => __('Replication'),
589 'sort' => __('Sorting'),
590 'table' => __('Tables'),
591 'tc' => __('Transaction coordinator'),
592 'files' => __('Files'),
593 'ssl' => 'SSL',
594 'other' => __('Other')
598 * define some needfull links/commands
600 // variable or section name => (name => url)
601 $links = array();
603 $links['table'][__('Flush (close) all tables')]
604 = $PMA_PHP_SELF . '?flush=TABLES&amp;' . PMA_generate_common_url();
605 $links['table'][__('Show open tables')]
606 = 'sql.php?sql_query=' . urlencode('SHOW OPEN TABLES') .
607 '&amp;goto=server_status.php&amp;' . PMA_generate_common_url();
609 if ($server_master_status) {
610 $links['repl'][__('Show slave hosts')]
611 = 'sql.php?sql_query=' . urlencode('SHOW SLAVE HOSTS') .
612 '&amp;goto=server_status.php&amp;' . PMA_generate_common_url();
613 $links['repl'][__('Show master status')] = '#replication_master';
615 if ($server_slave_status) {
616 $links['repl'][__('Show slave status')] = '#replication_slave';
619 $links['repl']['doc'] = 'replication';
621 $links['qcache'][__('Flush query cache')]
622 = $PMA_PHP_SELF . '?flush=' . urlencode('QUERY CACHE') . '&amp;' .
623 PMA_generate_common_url();
624 $links['qcache']['doc'] = 'query_cache';
626 //$links['threads'][__('Show processes')]
627 // = 'server_processlist.php?' . PMA_generate_common_url();
628 $links['threads']['doc'] = 'mysql_threads';
630 $links['key']['doc'] = 'myisam_key_cache';
632 $links['binlog_cache']['doc'] = 'binary_log';
634 $links['Slow_queries']['doc'] = 'slow_query_log';
636 $links['innodb'][__('Variables')]
637 = 'server_engines.php?engine=InnoDB&amp;' . PMA_generate_common_url();
638 $links['innodb'][__('InnoDB Status')]
639 = 'server_engines.php?engine=InnoDB&amp;page=Status&amp;' .
640 PMA_generate_common_url();
641 $links['innodb']['doc'] = 'innodb';
644 // Variable to contain all com_ variables (query statistics)
645 $used_queries = array();
647 // Variable to map variable names to their respective section name
648 // (used for js category filtering)
649 $allocationMap = array();
651 // Variable to mark used sections
652 $categoryUsed = array();
654 // sort vars into arrays
655 foreach ($server_status as $name => $value) {
656 $section_found = false;
657 foreach ($allocations as $filter => $section) {
658 if (strpos($name, $filter) !== false) {
659 $allocationMap[$name] = $section;
660 $categoryUsed[$section] = true;
661 $section_found = true;
662 if ($section == 'com' && $value > 0) {
663 $used_queries[$name] = $value;
665 break; // Only exits inner loop
668 if (!$section_found) {
669 $allocationMap[$name] = 'other';
670 $categoryUsed['other'] = true;
674 if(PMA_DRIZZLE) {
675 $used_queries = PMA_DBI_fetch_result(
676 'SELECT * FROM data_dictionary.global_statements',
680 unset($used_queries['admin_commands']);
681 } else {
682 // admin commands are not queries (e.g. they include COM_PING,
683 // which is excluded from $server_status['Questions'])
684 unset($used_queries['Com_admin_commands']);
687 /* Ajax request refresh */
688 if (isset($_REQUEST['show']) && isset($_REQUEST['ajax_request'])) {
689 switch($_REQUEST['show']) {
690 case 'query_statistics':
691 printQueryStatistics();
692 exit();
693 case 'server_traffic':
694 printServerTraffic();
695 exit();
696 case 'variables_table':
697 // Prints the variables table
698 printVariablesTable();
699 exit();
701 default:
702 break;
706 $server_db_isLocal = strtolower($cfg['Server']['host']) == 'localhost'
707 || $cfg['Server']['host'] == '127.0.0.1'
708 || $cfg['Server']['host'] == '::1';
710 PMA_AddJSVar(
711 'pma_token',
712 $_SESSION[' PMA_token ']
714 PMA_AddJSVar(
715 'url_query',
716 str_replace('&amp;', '&', PMA_generate_common_url($db))
718 PMA_AddJSVar(
719 'server_time_diff',
720 'new Date().getTime() - ' . (microtime(true) * 1000),
721 false
723 PMA_AddJSVar(
724 'server_os',
725 PHP_OS
727 PMA_AddJSVar(
728 'is_superuser',
729 PMA_isSuperuser()
731 PMA_AddJSVar(
732 'server_db_isLocal',
733 $server_db_isLocal
735 PMA_AddJSVar(
736 'profiling_docu',
737 PMA_showMySQLDocu('general-thread-states', 'general-thread-states')
739 PMA_AddJSVar(
740 'explain_docu',
741 PMA_showMySQLDocu('explain-output', 'explain-output')
745 * start output
749 * Does the common work
751 require './libraries/server_common.inc.php';
756 * Displays the links
758 require './libraries/server_links.inc.php';
761 <div id="serverstatus">
762 <h2><?php
764 * Displays the sub-page heading
766 if ($GLOBALS['cfg']['MainPageIconic']) {
767 echo '<img class="icon ic_s_status" src="themes/dot.gif" width="16" height="16" alt="" />';
770 echo __('Runtime Information');
772 ?></h2>
773 <div id="serverStatusTabs">
774 <ul>
775 <li><a href="#statustabs_traffic"><?php echo __('Server'); ?></a></li>
776 <li><a href="#statustabs_queries"><?php echo __('Query statistics'); ?></a></li>
777 <li><a href="#statustabs_allvars"><?php echo __('All status variables'); ?></a></li>
778 <li class="jsfeature"><a href="#statustabs_charting"><?php echo __('Monitor'); ?></a></li>
779 <li class="jsfeature"><a href="#statustabs_advisor"><?php echo __('Advisor'); ?></a></li>
780 </ul>
782 <div id="statustabs_traffic" class="clearfloat">
783 <div class="buttonlinks jsfeature">
784 <a class="tabRefresh" href="<?php echo $PMA_PHP_SELF . '?show=server_traffic&amp;' . PMA_generate_common_url(); ?>" >
785 <img src="<?php echo $GLOBALS['pmaThemeImage'];?>ajax_clock_small.gif" alt="ajax clock" style="display: none;" />
786 <?php echo __('Refresh'); ?>
787 </a>
788 <span class="refreshList" style="display:none;">
789 <label for="id_trafficChartRefresh"><?php echo __('Refresh rate: '); ?></label>
790 <?php refreshList('trafficChartRefresh'); ?>
791 </span>
793 <a class="tabChart livetrafficLink" href="#">
794 <?php echo __('Live traffic chart'); ?>
795 </a>
796 <a class="tabChart liveconnectionsLink" href="#">
797 <?php echo __('Live conn./process chart'); ?>
798 </a>
799 </div>
800 <div class="tabInnerContent">
801 <?php printServerTraffic(); ?>
802 </div>
803 </div>
804 <div id="statustabs_queries" class="clearfloat">
805 <div class="buttonlinks jsfeature">
806 <a class="tabRefresh" href="<?php echo $PMA_PHP_SELF . '?show=query_statistics&amp;' . PMA_generate_common_url(); ?>" >
807 <img src="<?php echo $GLOBALS['pmaThemeImage'];?>ajax_clock_small.gif" alt="ajax clock" style="display: none;" />
808 <?php echo __('Refresh'); ?>
809 </a>
810 <span class="refreshList" style="display:none;">
811 <label for="id_queryChartRefresh"><?php echo __('Refresh rate: '); ?></label>
812 <?php refreshList('queryChartRefresh'); ?>
813 </span>
814 <a class="tabChart livequeriesLink" href="#">
815 <?php echo __('Live query chart'); ?>
816 </a>
817 </div>
818 <div class="tabInnerContent">
819 <?php printQueryStatistics(); ?>
820 </div>
821 </div>
822 <div id="statustabs_allvars" class="clearfloat">
823 <fieldset id="tableFilter" class="jsfeature">
824 <div class="buttonlinks">
825 <a class="tabRefresh" href="<?php echo $PMA_PHP_SELF . '?show=variables_table&amp;' . PMA_generate_common_url(); ?>" >
826 <img src="<?php echo $GLOBALS['pmaThemeImage'];?>ajax_clock_small.gif" alt="ajax clock" style="display: none;" />
827 <?php echo __('Refresh'); ?>
828 </a>
829 </div>
830 <legend>Filters</legend>
831 <div class="formelement">
832 <label for="filterText"><?php echo __('Containing the word:'); ?></label>
833 <input name="filterText" type="text" id="filterText" style="vertical-align: baseline;" />
834 </div>
835 <div class="formelement">
836 <input type="checkbox" name="filterAlert" id="filterAlert" />
837 <label for="filterAlert"><?php echo __('Show only alert values'); ?></label>
838 </div>
839 <div class="formelement">
840 <select id="filterCategory" name="filterCategory">
841 <option value=''><?php echo __('Filter by category...'); ?></option>
842 <?php
843 foreach ($sections as $section_id => $section_name) {
844 if (isset($categoryUsed[$section_id])) {
846 <option value='<?php echo $section_id; ?>'><?php echo $section_name; ?></option>
847 <?php
851 </select>
852 </div>
853 <div class="formelement">
854 <input type="checkbox" name="dontFormat" id="dontFormat" />
855 <label for="dontFormat"><?php echo __('Show unformatted values'); ?></label>
856 </div>
857 </fieldset>
858 <div id="linkSuggestions" class="defaultLinks" style="display:none">
859 <p class="notice"><?php echo __('Related links:'); ?>
860 <?php
861 foreach ($links as $section_name => $section_links) {
862 echo '<span class="status_' . $section_name . '"> ';
863 $i=0;
864 foreach ($section_links as $link_name => $link_url) {
865 if ($i > 0) {
866 echo ', ';
868 if ('doc' == $link_name) {
869 echo PMA_showMySQLDocu($link_url, $link_url);
870 } else {
871 echo '<a href="' . $link_url . '">' . $link_name . '</a>';
873 $i++;
875 echo '</span>';
877 unset($link_url, $link_name, $i);
879 </p>
880 </div>
881 <div class="tabInnerContent">
882 <?php printVariablesTable(); ?>
883 </div>
884 </div>
886 <div id="statustabs_charting" class="jsfeature">
887 <?php printMonitor(); ?>
888 </div>
890 <div id="statustabs_advisor" class="jsfeature">
891 <div class="tabLinks">
892 <img src="themes/dot.gif" class="icon ic_play" alt="" /> <a href="#startAnalyzer"><?php echo __('Run analyzer'); ?></a>
893 <img src="themes/dot.gif" class="icon ic_b_help" alt="" /> <a href="#openAdvisorInstructions"><?php echo __('Instructions'); ?></a>
894 </div>
895 <div class="tabInnerContent clearfloat">
896 </div>
897 <div id="advisorInstructionsDialog" style="display:none;">
898 <?php
899 echo '<p>';
900 echo __('The Advisor system can provide recommendations on server variables by analyzing the server status variables.');
901 echo '</p> <p>';
902 echo __('Do note however that this system provides recommendations based on simple calculations and by rule of thumb which may not necessarily apply to your system.');
903 echo '</p> <p>';
904 echo __('Prior to changing any of the configuration, be sure to know what you are changing (by reading the documentation) and how to undo the change. Wrong tuning can have a very negative effect on performance.');
905 echo '</p> <p>';
906 echo __('The best way to tune your system would be to change only one setting at a time, observe or benchmark your database, and undo the change if there was no clearly measurable improvement.');
907 echo '</p>';
909 </div>
910 </div>
911 </div>
912 </div>
914 <?php
916 function printQueryStatistics()
918 global $server_status, $used_queries, $url_query, $PMA_PHP_SELF;
920 $hour_factor = 3600 / $server_status['Uptime'];
922 $total_queries = array_sum($used_queries);
925 <h3 id="serverstatusqueries">
926 <?php
927 /* l10n: Questions is the name of a MySQL Status variable */
928 echo sprintf(__('Questions since startup: %s'), PMA_formatNumber($total_queries, 0)) . ' ';
929 echo PMA_showMySQLDocu('server-status-variables', 'server-status-variables', false, 'statvar_Questions');
931 <br />
932 <span>
933 <?php
934 echo '&oslash; ' . __('per hour') . ': ';
935 echo PMA_formatNumber($total_queries * $hour_factor, 0);
936 echo '<br />';
938 echo '&oslash; ' . __('per minute') . ': ';
939 echo PMA_formatNumber( $total_queries * 60 / $server_status['Uptime'], 0);
940 echo '<br />';
942 if ($total_queries / $server_status['Uptime'] >= 1) {
943 echo '&oslash; ' . __('per second') . ': ';
944 echo PMA_formatNumber( $total_queries / $server_status['Uptime'], 0);
947 </span>
948 </h3>
949 <?php
951 // reverse sort by value to show most used statements first
952 arsort($used_queries);
954 $odd_row = true;
955 $count_displayed_rows = 0;
956 $perc_factor = 100 / $total_queries; //(- $server_status['Connections']);
960 <table id="serverstatusqueriesdetails" class="data sortable noclick">
961 <col class="namecol" />
962 <col class="valuecol" span="3" />
963 <thead>
964 <tr><th><?php echo __('Statements'); ?></th>
965 <th><?php
966 /* l10n: # = Amount of queries */
967 echo __('#');
969 </th>
970 <th>&oslash; <?php echo __('per hour'); ?></th>
971 <th>%</th>
972 </tr>
973 </thead>
974 <tbody>
976 <?php
977 $chart_json = array();
978 $query_sum = array_sum($used_queries);
979 $other_sum = 0;
980 foreach ($used_queries as $name => $value) {
981 $odd_row = !$odd_row;
983 // For the percentage column, use Questions - Connections, because
984 // the number of connections is not an item of the Query types
985 // but is included in Questions. Then the total of the percentages is 100.
986 $name = str_replace(array('Com_', '_'), array('', ' '), $name);
988 // Group together values that make out less than 2% into "Other", but only if we have more than 6 fractions already
989 if ($value < $query_sum * 0.02 && count($chart_json)>6) {
990 $other_sum += $value;
991 } else {
992 $chart_json[$name] = $value;
995 <tr class="<?php echo $odd_row ? 'odd' : 'even'; ?>">
996 <th class="name"><?php echo htmlspecialchars($name); ?></th>
997 <td class="value"><?php echo htmlspecialchars(PMA_formatNumber($value, 5, 0, true)); ?></td>
998 <td class="value"><?php echo
999 htmlspecialchars(PMA_formatNumber($value * $hour_factor, 4, 1, true)); ?></td>
1000 <td class="value"><?php echo
1001 htmlspecialchars(PMA_formatNumber($value * $perc_factor, 0, 2)); ?>%</td>
1002 </tr>
1003 <?php
1006 </tbody>
1007 </table>
1009 <div id="serverstatusquerieschart">
1010 <span style="display:none;">
1011 <?php
1012 if ($other_sum > 0) {
1013 $chart_json[__('Other')] = $other_sum;
1016 echo json_encode($chart_json);
1018 </span>
1019 </div>
1020 <?php
1023 function printServerTraffic()
1025 global $server_status, $PMA_PHP_SELF;
1026 global $server_master_status, $server_slave_status, $replication_types;
1028 $hour_factor = 3600 / $server_status['Uptime'];
1031 * starttime calculation
1033 $start_time = PMA_DBI_fetch_value(
1034 'SELECT UNIX_TIMESTAMP() - ' . $server_status['Uptime']);
1037 <h3><?php
1038 echo sprintf(
1039 __('Network traffic since startup: %s'),
1040 implode(' ', PMA_formatByteDown( $server_status['Bytes_received'] + $server_status['Bytes_sent'], 3, 1))
1043 </h3>
1046 <?php
1047 echo sprintf(__('This MySQL server has been running for %1$s. It started up on %2$s.'),
1048 PMA_timespanFormat($server_status['Uptime']),
1049 PMA_localisedDate($start_time)) . "\n";
1051 </p>
1053 <?php
1054 if ($server_master_status || $server_slave_status) {
1055 echo '<p class="notice">';
1056 if ($server_master_status && $server_slave_status) {
1057 echo __('This MySQL server works as <b>master</b> and <b>slave</b> in <b>replication</b> process.');
1058 } elseif ($server_master_status) {
1059 echo __('This MySQL server works as <b>master</b> in <b>replication</b> process.');
1060 } elseif ($server_slave_status) {
1061 echo __('This MySQL server works as <b>slave</b> in <b>replication</b> process.');
1063 echo ' ';
1064 echo __('For further information about replication status on the server, please visit the <a href="#replication">replication section</a>.');
1065 echo '</p>';
1068 /* if the server works as master or slave in replication process, display useful information */
1069 if ($server_master_status || $server_slave_status) {
1071 <hr class="clearfloat" />
1073 <h3><a name="replication"></a><?php echo __('Replication status'); ?></h3>
1074 <?php
1076 foreach ($replication_types as $type)
1078 if (${"server_{$type}_status"}) {
1079 PMA_replication_print_status_table($type);
1082 unset($types);
1086 <table id="serverstatustraffic" class="data noclick">
1087 <thead>
1088 <tr>
1089 <th colspan="2"><?php echo __('Traffic') . '&nbsp;' . PMA_showHint(__('On a busy server, the byte counters may overrun, so those statistics as reported by the MySQL server may be incorrect.')); ?></th>
1090 <th>&oslash; <?php echo __('per hour'); ?></th>
1091 </tr>
1092 </thead>
1093 <tbody>
1094 <tr class="odd">
1095 <th class="name"><?php echo __('Received'); ?></th>
1096 <td class="value"><?php echo
1097 implode(' ',
1098 PMA_formatByteDown($server_status['Bytes_received'], 3, 1)); ?></td>
1099 <td class="value"><?php echo
1100 implode(' ',
1101 PMA_formatByteDown(
1102 $server_status['Bytes_received'] * $hour_factor, 3, 1)); ?></td>
1103 </tr>
1104 <tr class="even">
1105 <th class="name"><?php echo __('Sent'); ?></th>
1106 <td class="value"><?php echo
1107 implode(' ',
1108 PMA_formatByteDown($server_status['Bytes_sent'], 3, 1)); ?></td>
1109 <td class="value"><?php echo
1110 implode(' ',
1111 PMA_formatByteDown(
1112 $server_status['Bytes_sent'] * $hour_factor, 3, 1)); ?></td>
1113 </tr>
1114 <tr class="odd">
1115 <th class="name"><?php echo __('Total'); ?></th>
1116 <td class="value"><?php echo
1117 implode(' ',
1118 PMA_formatByteDown(
1119 $server_status['Bytes_received'] + $server_status['Bytes_sent'], 3, 1)
1120 ); ?></td>
1121 <td class="value"><?php echo
1122 implode(' ',
1123 PMA_formatByteDown(
1124 ($server_status['Bytes_received'] + $server_status['Bytes_sent'])
1125 * $hour_factor, 3, 1)
1126 ); ?></td>
1127 </tr>
1128 </tbody>
1129 </table>
1131 <table id="serverstatusconnections" class="data noclick">
1132 <thead>
1133 <tr>
1134 <th colspan="2"><?php echo __('Connections'); ?></th>
1135 <th>&oslash; <?php echo __('per hour'); ?></th>
1136 <th>%</th>
1137 </tr>
1138 </thead>
1139 <tbody>
1140 <tr class="odd">
1141 <th class="name"><?php echo __('max. concurrent connections'); ?></th>
1142 <td class="value"><?php echo
1143 PMA_formatNumber($server_status['Max_used_connections'], 0); ?> </td>
1144 <td class="value">--- </td>
1145 <td class="value">--- </td>
1146 </tr>
1147 <tr class="even">
1148 <th class="name"><?php echo __('Failed attempts'); ?></th>
1149 <td class="value"><?php echo
1150 PMA_formatNumber($server_status['Aborted_connects'], 4, 1, true); ?></td>
1151 <td class="value"><?php echo
1152 PMA_formatNumber($server_status['Aborted_connects'] * $hour_factor,
1153 4, 2, true); ?></td>
1154 <td class="value"><?php echo
1155 $server_status['Connections'] > 0
1156 ? PMA_formatNumber(
1157 $server_status['Aborted_connects'] * 100 / $server_status['Connections'],
1158 0, 2, true) . '%'
1159 : '--- '; ?></td>
1160 </tr>
1161 <tr class="odd">
1162 <th class="name"><?php echo __('Aborted'); ?></th>
1163 <td class="value"><?php echo
1164 PMA_formatNumber($server_status['Aborted_clients'], 4, 1, true); ?></td>
1165 <td class="value"><?php echo
1166 PMA_formatNumber($server_status['Aborted_clients'] * $hour_factor,
1167 4, 2, true); ?></td>
1168 <td class="value"><?php echo
1169 $server_status['Connections'] > 0
1170 ? PMA_formatNumber(
1171 $server_status['Aborted_clients'] * 100 / $server_status['Connections'],
1172 0, 2, true) . '%'
1173 : '--- '; ?></td>
1174 </tr>
1175 <tr class="even">
1176 <th class="name"><?php echo __('Total'); ?></th>
1177 <td class="value"><?php echo
1178 PMA_formatNumber($server_status['Connections'], 4, 0); ?></td>
1179 <td class="value"><?php echo
1180 PMA_formatNumber($server_status['Connections'] * $hour_factor,
1181 4, 2); ?></td>
1182 <td class="value"><?php echo
1183 PMA_formatNumber(100, 0, 2); ?>%</td>
1184 </tr>
1185 </tbody>
1186 </table>
1187 <?php
1189 $url_params = array();
1191 $show_full_sql = !empty($_REQUEST['full']);
1192 if ($show_full_sql) {
1193 $url_params['full'] = 1;
1194 $full_text_link = 'server_status.php' . PMA_generate_common_url(array(), 'html', '?');
1195 } else {
1196 $full_text_link = 'server_status.php' . PMA_generate_common_url(array('full' => 1));
1198 if (PMA_DRIZZLE) {
1199 $sql_query = "SELECT
1200 p.id AS Id,
1201 p.username AS User,
1202 p.host AS Host,
1203 p.db AS db,
1204 p.command AS Command,
1205 p.time AS Time,
1206 p.state AS State,
1207 " . ($show_full_sql ? 's.query' : 'left(p.info, ' . (int)$GLOBALS['cfg']['MaxCharactersInDisplayedSQL'] . ')') . " AS Info
1208 FROM data_dictionary.PROCESSLIST p
1209 " . ($show_full_sql ? 'LEFT JOIN data_dictionary.SESSIONS s ON s.session_id = p.id' : '');
1210 } else {
1211 $sql_query = $show_full_sql
1212 ? 'SHOW FULL PROCESSLIST'
1213 : 'SHOW PROCESSLIST';
1215 $result = PMA_DBI_query($sql_query);
1218 * Displays the page
1221 <table id="tableprocesslist" class="data clearfloat noclick">
1222 <thead>
1223 <tr>
1224 <th><?php echo __('Processes'); ?></th>
1225 <th><?php echo __('ID'); ?></th>
1226 <th><?php echo __('User'); ?></th>
1227 <th><?php echo __('Host'); ?></th>
1228 <th><?php echo __('Database'); ?></th>
1229 <th><?php echo __('Command'); ?></th>
1230 <th><?php echo __('Time'); ?></th>
1231 <th><?php echo __('Status'); ?></th>
1232 <th><?php
1233 echo __('SQL query');
1234 if (! PMA_DRIZZLE) {
1236 <a href="<?php echo $full_text_link; ?>"
1237 title="<?php echo $show_full_sql ? __('Truncate Shown Queries') : __('Show Full Queries'); ?>">
1238 <img src="<?php echo $GLOBALS['pmaThemeImage'] . 's_' . ($show_full_sql ? 'partial' : 'full'); ?>text.png"
1239 alt="<?php echo $show_full_sql ? __('Truncate Shown Queries') : __('Show Full Queries'); ?>" />
1240 </a>
1241 <?php } ?>
1242 </th>
1243 </tr>
1244 </thead>
1245 <tbody>
1246 <?php
1247 $odd_row = true;
1248 while ($process = PMA_DBI_fetch_assoc($result)) {
1249 $url_params['kill'] = $process['Id'];
1250 $kill_process = 'server_status.php' . PMA_generate_common_url($url_params);
1252 <tr class="<?php echo $odd_row ? 'odd' : 'even'; ?>">
1253 <td><a href="<?php echo $kill_process ; ?>"><?php echo __('Kill'); ?></a></td>
1254 <td class="value"><?php echo $process['Id']; ?></td>
1255 <td><?php echo $process['User']; ?></td>
1256 <td><?php echo $process['Host']; ?></td>
1257 <td><?php echo ((! isset($process['db']) || ! strlen($process['db'])) ? '<i>' . __('None') . '</i>' : $process['db']); ?></td>
1258 <td><?php echo $process['Command']; ?></td>
1259 <td class="value"><?php echo $process['Time']; ?></td>
1260 <td><?php echo (empty($process['State']) ? '---' : $process['State']); ?></td>
1261 <td>
1262 <?php
1263 if (empty($process['Info'])) {
1264 echo '---';
1265 } else {
1266 if (!$show_full_sql && strlen($process['Info']) > $GLOBALS['cfg']['MaxCharactersInDisplayedSQL']) {
1267 echo htmlspecialchars(substr($process['Info'], 0, $GLOBALS['cfg']['MaxCharactersInDisplayedSQL'])) . '[...]';
1268 } else {
1269 echo PMA_SQP_formatHtml(PMA_SQP_parse($process['Info']));
1273 </td>
1274 </tr>
1275 <?php
1276 $odd_row = ! $odd_row;
1279 </tbody>
1280 </table>
1281 <?php
1284 function printVariablesTable()
1286 global $server_status, $server_variables, $allocationMap, $links;
1288 * Messages are built using the message name
1290 $strShowStatus = array(
1291 'Aborted_clients' => __('The number of connections that were aborted because the client died without closing the connection properly.'),
1292 'Aborted_connects' => __('The number of failed attempts to connect to the MySQL server.'),
1293 'Binlog_cache_disk_use' => __('The number of transactions that used the temporary binary log cache but that exceeded the value of binlog_cache_size and used a temporary file to store statements from the transaction.'),
1294 'Binlog_cache_use' => __('The number of transactions that used the temporary binary log cache.'),
1295 'Connections' => __('The number of connection attempts (successful or not) to the MySQL server.'),
1296 'Created_tmp_disk_tables' => __('The number of temporary tables on disk created automatically by the server while executing statements. If Created_tmp_disk_tables is big, you may want to increase the tmp_table_size value to cause temporary tables to be memory-based instead of disk-based.'),
1297 'Created_tmp_files' => __('How many temporary files mysqld has created.'),
1298 'Created_tmp_tables' => __('The number of in-memory temporary tables created automatically by the server while executing statements.'),
1299 'Delayed_errors' => __('The number of rows written with INSERT DELAYED for which some error occurred (probably duplicate key).'),
1300 'Delayed_insert_threads' => __('The number of INSERT DELAYED handler threads in use. Every different table on which one uses INSERT DELAYED gets its own thread.'),
1301 'Delayed_writes' => __('The number of INSERT DELAYED rows written.'),
1302 'Flush_commands' => __('The number of executed FLUSH statements.'),
1303 'Handler_commit' => __('The number of internal COMMIT statements.'),
1304 'Handler_delete' => __('The number of times a row was deleted from a table.'),
1305 'Handler_discover' => __('The MySQL server can ask the NDB Cluster storage engine if it knows about a table with a given name. This is called discovery. Handler_discover indicates the number of time tables have been discovered.'),
1306 'Handler_read_first' => __('The number of times the first entry was read from an index. If this is high, it suggests that the server is doing a lot of full index scans; for example, SELECT col1 FROM foo, assuming that col1 is indexed.'),
1307 'Handler_read_key' => __('The number of requests to read a row based on a key. If this is high, it is a good indication that your queries and tables are properly indexed.'),
1308 'Handler_read_next' => __('The number of requests to read the next row in key order. This is incremented if you are querying an index column with a range constraint or if you are doing an index scan.'),
1309 'Handler_read_prev' => __('The number of requests to read the previous row in key order. This read method is mainly used to optimize ORDER BY ... DESC.'),
1310 'Handler_read_rnd' => __('The number of requests to read a row based on a fixed position. This is high if you are doing a lot of queries that require sorting of the result. You probably have a lot of queries that require MySQL to scan whole tables or you have joins that don\'t use keys properly.'),
1311 'Handler_read_rnd_next' => __('The number of requests to read the next row in the data file. This is high if you are doing a lot of table scans. Generally this suggests that your tables are not properly indexed or that your queries are not written to take advantage of the indexes you have.'),
1312 'Handler_rollback' => __('The number of internal ROLLBACK statements.'),
1313 'Handler_update' => __('The number of requests to update a row in a table.'),
1314 'Handler_write' => __('The number of requests to insert a row in a table.'),
1315 'Innodb_buffer_pool_pages_data' => __('The number of pages containing data (dirty or clean).'),
1316 'Innodb_buffer_pool_pages_dirty' => __('The number of pages currently dirty.'),
1317 'Innodb_buffer_pool_pages_flushed' => __('The number of buffer pool pages that have been requested to be flushed.'),
1318 'Innodb_buffer_pool_pages_free' => __('The number of free pages.'),
1319 'Innodb_buffer_pool_pages_latched' => __('The number of latched pages in InnoDB buffer pool. These are pages currently being read or written or that can\'t be flushed or removed for some other reason.'),
1320 'Innodb_buffer_pool_pages_misc' => __('The number of pages busy because they have been allocated for administrative overhead such as row locks or the adaptive hash index. This value can also be calculated as Innodb_buffer_pool_pages_total - Innodb_buffer_pool_pages_free - Innodb_buffer_pool_pages_data.'),
1321 'Innodb_buffer_pool_pages_total' => __('Total size of buffer pool, in pages.'),
1322 'Innodb_buffer_pool_read_ahead_rnd' => __('The number of "random" read-aheads InnoDB initiated. This happens when a query is to scan a large portion of a table but in random order.'),
1323 'Innodb_buffer_pool_read_ahead_seq' => __('The number of sequential read-aheads InnoDB initiated. This happens when InnoDB does a sequential full table scan.'),
1324 'Innodb_buffer_pool_read_requests' => __('The number of logical read requests InnoDB has done.'),
1325 'Innodb_buffer_pool_reads' => __('The number of logical reads that InnoDB could not satisfy from buffer pool and had to do a single-page read.'),
1326 'Innodb_buffer_pool_wait_free' => __('Normally, writes to the InnoDB buffer pool happen in the background. However, if it\'s necessary to read or create a page and no clean pages are available, it\'s necessary to wait for pages to be flushed first. This counter counts instances of these waits. If the buffer pool size was set properly, this value should be small.'),
1327 'Innodb_buffer_pool_write_requests' => __('The number writes done to the InnoDB buffer pool.'),
1328 'Innodb_data_fsyncs' => __('The number of fsync() operations so far.'),
1329 'Innodb_data_pending_fsyncs' => __('The current number of pending fsync() operations.'),
1330 'Innodb_data_pending_reads' => __('The current number of pending reads.'),
1331 'Innodb_data_pending_writes' => __('The current number of pending writes.'),
1332 'Innodb_data_read' => __('The amount of data read so far, in bytes.'),
1333 'Innodb_data_reads' => __('The total number of data reads.'),
1334 'Innodb_data_writes' => __('The total number of data writes.'),
1335 'Innodb_data_written' => __('The amount of data written so far, in bytes.'),
1336 'Innodb_dblwr_pages_written' => __('The number of pages that have been written for doublewrite operations.'),
1337 'Innodb_dblwr_writes' => __('The number of doublewrite operations that have been performed.'),
1338 'Innodb_log_waits' => __('The number of waits we had because log buffer was too small and we had to wait for it to be flushed before continuing.'),
1339 'Innodb_log_write_requests' => __('The number of log write requests.'),
1340 'Innodb_log_writes' => __('The number of physical writes to the log file.'),
1341 'Innodb_os_log_fsyncs' => __('The number of fsync() writes done to the log file.'),
1342 'Innodb_os_log_pending_fsyncs' => __('The number of pending log file fsyncs.'),
1343 'Innodb_os_log_pending_writes' => __('Pending log file writes.'),
1344 'Innodb_os_log_written' => __('The number of bytes written to the log file.'),
1345 'Innodb_pages_created' => __('The number of pages created.'),
1346 'Innodb_page_size' => __('The compiled-in InnoDB page size (default 16KB). Many values are counted in pages; the page size allows them to be easily converted to bytes.'),
1347 'Innodb_pages_read' => __('The number of pages read.'),
1348 'Innodb_pages_written' => __('The number of pages written.'),
1349 'Innodb_row_lock_current_waits' => __('The number of row locks currently being waited for.'),
1350 'Innodb_row_lock_time_avg' => __('The average time to acquire a row lock, in milliseconds.'),
1351 'Innodb_row_lock_time' => __('The total time spent in acquiring row locks, in milliseconds.'),
1352 'Innodb_row_lock_time_max' => __('The maximum time to acquire a row lock, in milliseconds.'),
1353 'Innodb_row_lock_waits' => __('The number of times a row lock had to be waited for.'),
1354 'Innodb_rows_deleted' => __('The number of rows deleted from InnoDB tables.'),
1355 'Innodb_rows_inserted' => __('The number of rows inserted in InnoDB tables.'),
1356 'Innodb_rows_read' => __('The number of rows read from InnoDB tables.'),
1357 'Innodb_rows_updated' => __('The number of rows updated in InnoDB tables.'),
1358 'Key_blocks_not_flushed' => __('The number of key blocks in the key cache that have changed but haven\'t yet been flushed to disk. It used to be known as Not_flushed_key_blocks.'),
1359 'Key_blocks_unused' => __('The number of unused blocks in the key cache. You can use this value to determine how much of the key cache is in use.'),
1360 'Key_blocks_used' => __('The number of used blocks in the key cache. This value is a high-water mark that indicates the maximum number of blocks that have ever been in use at one time.'),
1361 'Key_read_requests' => __('The number of requests to read a key block from the cache.'),
1362 'Key_reads' => __('The number of physical reads of a key block from disk. If Key_reads is big, then your key_buffer_size value is probably too small. The cache miss rate can be calculated as Key_reads/Key_read_requests.'),
1363 'Key_write_requests' => __('The number of requests to write a key block to the cache.'),
1364 'Key_writes' => __('The number of physical writes of a key block to disk.'),
1365 'Last_query_cost' => __('The total cost of the last compiled query as computed by the query optimizer. Useful for comparing the cost of different query plans for the same query. The default value of 0 means that no query has been compiled yet.'),
1366 'Max_used_connections' => __('The maximum number of connections that have been in use simultaneously since the server started.'),
1367 'Not_flushed_delayed_rows' => __('The number of rows waiting to be written in INSERT DELAYED queues.'),
1368 'Opened_tables' => __('The number of tables that have been opened. If opened tables is big, your table cache value is probably too small.'),
1369 'Open_files' => __('The number of files that are open.'),
1370 'Open_streams' => __('The number of streams that are open (used mainly for logging).'),
1371 'Open_tables' => __('The number of tables that are open.'),
1372 'Qcache_free_blocks' => __('The number of free memory blocks in query cache. High numbers can indicate fragmentation issues, which may be solved by issuing a FLUSH QUERY CACHE statement.'),
1373 'Qcache_free_memory' => __('The amount of free memory for query cache.'),
1374 'Qcache_hits' => __('The number of cache hits.'),
1375 'Qcache_inserts' => __('The number of queries added to the cache.'),
1376 'Qcache_lowmem_prunes' => __('The number of queries that have been removed from the cache to free up memory for caching new queries. This information can help you tune the query cache size. The query cache uses a least recently used (LRU) strategy to decide which queries to remove from the cache.'),
1377 'Qcache_not_cached' => __('The number of non-cached queries (not cachable, or not cached due to the query_cache_type setting).'),
1378 'Qcache_queries_in_cache' => __('The number of queries registered in the cache.'),
1379 'Qcache_total_blocks' => __('The total number of blocks in the query cache.'),
1380 'Rpl_status' => __('The status of failsafe replication (not yet implemented).'),
1381 'Select_full_join' => __('The number of joins that do not use indexes. If this value is not 0, you should carefully check the indexes of your tables.'),
1382 'Select_full_range_join' => __('The number of joins that used a range search on a reference table.'),
1383 'Select_range_check' => __('The number of joins without keys that check for key usage after each row. (If this is not 0, you should carefully check the indexes of your tables.)'),
1384 'Select_range' => __('The number of joins that used ranges on the first table. (It\'s normally not critical even if this is big.)'),
1385 'Select_scan' => __('The number of joins that did a full scan of the first table.'),
1386 'Slave_open_temp_tables' => __('The number of temporary tables currently open by the slave SQL thread.'),
1387 'Slave_retried_transactions' => __('Total (since startup) number of times the replication slave SQL thread has retried transactions.'),
1388 'Slave_running' => __('This is ON if this server is a slave that is connected to a master.'),
1389 'Slow_launch_threads' => __('The number of threads that have taken more than slow_launch_time seconds to create.'),
1390 'Slow_queries' => __('The number of queries that have taken more than long_query_time seconds.'),
1391 'Sort_merge_passes' => __('The number of merge passes the sort algorithm has had to do. If this value is large, you should consider increasing the value of the sort_buffer_size system variable.'),
1392 'Sort_range' => __('The number of sorts that were done with ranges.'),
1393 'Sort_rows' => __('The number of sorted rows.'),
1394 'Sort_scan' => __('The number of sorts that were done by scanning the table.'),
1395 'Table_locks_immediate' => __('The number of times that a table lock was acquired immediately.'),
1396 'Table_locks_waited' => __('The number of times that a table lock could not be acquired immediately and a wait was needed. If this is high, and you have performance problems, you should first optimize your queries, and then either split your table or tables or use replication.'),
1397 'Threads_cached' => __('The number of threads in the thread cache. The cache hit rate can be calculated as Threads_created/Connections. If this value is red you should raise your thread_cache_size.'),
1398 'Threads_connected' => __('The number of currently open connections.'),
1399 'Threads_created' => __('The number of threads created to handle connections. If Threads_created is big, you may want to increase the thread_cache_size value. (Normally this doesn\'t give a notable performance improvement if you have a good thread implementation.)'),
1400 'Threads_running' => __('The number of threads that are not sleeping.')
1404 * define some alerts
1406 // name => max value before alert
1407 $alerts = array(
1408 // lower is better
1409 // variable => max value
1410 'Aborted_clients' => 0,
1411 'Aborted_connects' => 0,
1413 'Binlog_cache_disk_use' => 0,
1415 'Created_tmp_disk_tables' => 0,
1417 'Handler_read_rnd' => 0,
1418 'Handler_read_rnd_next' => 0,
1420 'Innodb_buffer_pool_pages_dirty' => 0,
1421 'Innodb_buffer_pool_reads' => 0,
1422 'Innodb_buffer_pool_wait_free' => 0,
1423 'Innodb_log_waits' => 0,
1424 'Innodb_row_lock_time_avg' => 10, // ms
1425 'Innodb_row_lock_time_max' => 50, // ms
1426 'Innodb_row_lock_waits' => 0,
1428 'Slow_queries' => 0,
1429 'Delayed_errors' => 0,
1430 'Select_full_join' => 0,
1431 'Select_range_check' => 0,
1432 'Sort_merge_passes' => 0,
1433 'Opened_tables' => 0,
1434 'Table_locks_waited' => 0,
1435 'Qcache_lowmem_prunes' => 0,
1437 'Qcache_free_blocks' => isset($server_status['Qcache_total_blocks']) ? $server_status['Qcache_total_blocks'] / 5 : 0,
1438 'Slow_launch_threads' => 0,
1440 // depends on Key_read_requests
1441 // normaly lower then 1:0.01
1442 'Key_reads' => isset($server_status['Key_read_requests']) ? (0.01 * $server_status['Key_read_requests']) : 0,
1443 // depends on Key_write_requests
1444 // normaly nearly 1:1
1445 'Key_writes' => isset($server_status['Key_write_requests']) ? (0.9 * $server_status['Key_write_requests']) : 0,
1447 'Key_buffer_fraction' => 0.5,
1449 // alert if more than 95% of thread cache is in use
1450 'Threads_cached' => isset($server_variables['thread_cache_size']) ? 0.95 * $server_variables['thread_cache_size'] : 0
1452 // higher is better
1453 // variable => min value
1454 //'Handler read key' => '> ',
1458 <table class="data sortable noclick" id="serverstatusvariables">
1459 <col class="namecol" />
1460 <col class="valuecol" />
1461 <col class="descrcol" />
1462 <thead>
1463 <tr>
1464 <th><?php echo __('Variable'); ?></th>
1465 <th><?php echo __('Value'); ?></th>
1466 <th><?php echo __('Description'); ?></th>
1467 </tr>
1468 </thead>
1469 <tbody>
1470 <?php
1472 $odd_row = false;
1473 foreach ($server_status as $name => $value) {
1474 $odd_row = !$odd_row;
1476 <tr class="<?php echo $odd_row ? 'odd' : 'even'; echo isset($allocationMap[$name])?' s_' . $allocationMap[$name]:''; ?>">
1477 <th class="name"><?php echo htmlspecialchars(str_replace('_', ' ', $name)) . PMA_showMySQLDocu('server-status-variables', 'server-status-variables', false, 'statvar_' . $name); ?>
1478 </th>
1479 <td class="value"><span class="formatted"><?php
1480 if (isset($alerts[$name])) {
1481 if ($value > $alerts[$name]) {
1482 echo '<span class="attention">';
1483 } else {
1484 echo '<span class="allfine">';
1487 if ('%' === substr($name, -1, 1)) {
1488 echo htmlspecialchars(PMA_formatNumber($value, 0, 2)) . ' %';
1489 } elseif (strpos($name, 'Uptime') !== false) {
1490 echo htmlspecialchars(PMA_timespanFormat($value));
1491 } elseif (is_numeric($value) && $value == (int) $value && $value > 1000) {
1492 echo htmlspecialchars(PMA_formatNumber($value, 3, 1));
1493 } elseif (is_numeric($value) && $value == (int) $value) {
1494 echo htmlspecialchars(PMA_formatNumber($value, 3, 0));
1495 } elseif (is_numeric($value)) {
1496 echo htmlspecialchars(PMA_formatNumber($value, 3, 1));
1497 } else {
1498 echo htmlspecialchars($value);
1500 if (isset($alerts[$name])) {
1501 echo '</span>';
1503 ?></span><span style="display:none;" class="original"><?php echo $value; ?></span>
1504 </td>
1505 <td class="descr">
1506 <?php
1507 if (isset($strShowStatus[$name ])) {
1508 echo $strShowStatus[$name];
1511 if (isset($links[$name])) {
1512 foreach ($links[$name] as $link_name => $link_url) {
1513 if ('doc' == $link_name) {
1514 echo PMA_showMySQLDocu($link_url, $link_url);
1515 } else {
1516 echo ' <a href="' . $link_url . '">' . $link_name . '</a>' .
1517 "\n";
1520 unset($link_url, $link_name);
1523 </td>
1524 </tr>
1525 <?php
1528 </tbody>
1529 </table>
1530 <?php
1533 function printMonitor()
1535 global $server_status, $server_db_isLocal;
1537 <div class="tabLinks" style="display:none;">
1538 <a href="#pauseCharts">
1539 <img src="themes/dot.gif" class="icon ic_play" alt="" />
1540 <?php echo __('Start Monitor'); ?>
1541 </a>
1542 <a href="#settingsPopup" rel="popupLink" style="display:none;">
1543 <img src="themes/dot.gif" class="icon ic_s_cog" alt="" />
1544 <?php echo __('Settings'); ?>
1545 </a>
1546 <?php if (!PMA_DRIZZLE) { ?>
1547 <a href="#monitorInstructionsDialog">
1548 <img src="themes/dot.gif" class="icon ic_b_help" alt="" />
1549 <?php echo __('Instructions/Setup'); ?>
1550 </a>
1551 <?php } ?>
1552 <a href="#endChartEditMode" style="display:none;">
1553 <img src="themes/dot.gif" class="icon ic_s_okay" alt="" />
1554 <?php echo __('Done rearranging/editing charts'); ?>
1555 </a>
1556 </div>
1558 <div class="popupContent settingsPopup">
1559 <a href="#addNewChart">
1560 <img src="themes/dot.gif" class="icon ic_b_chart" alt="" />
1561 <?php echo __('Add chart'); ?>
1562 </a>
1563 <a href="#rearrangeCharts"><img class="icon ic_b_tblops" src="themes/dot.gif" width="16" height="16" alt="" /><?php echo __('Rearrange/edit charts'); ?></a>
1564 <div class="clearfloat paddingtop"></div>
1565 <div class="floatleft">
1566 <?php
1567 echo __('Refresh rate') . '<br />';
1568 refreshList('gridChartRefresh', 5, Array(2, 3, 4, 5, 10, 20, 40, 60, 120, 300, 600, 1200));
1569 ?><br />
1570 </div>
1571 <div class="floatleft">
1572 <?php echo __('Chart columns'); ?> <br />
1573 <select name="chartColumns">
1574 <option>1</option>
1575 <option>2</option>
1576 <option>3</option>
1577 <option>4</option>
1578 <option>5</option>
1579 <option>6</option>
1580 <option>7</option>
1581 <option>8</option>
1582 <option>9</option>
1583 <option>10</option>
1584 </select>
1585 </div>
1587 <div class="clearfloat paddingtop">
1588 <b><?php echo __('Chart arrangement'); ?></b> <?php echo PMA_showHint(__('The arrangement of the charts is stored to the browsers local storage. You may want to export it if you have a complicated set up.')); ?><br/>
1589 <a href="#importMonitorConfig"><?php echo __('Import'); ?></a>&nbsp;&nbsp;<a href="#exportMonitorConfig"><?php echo __('Export'); ?></a>&nbsp;&nbsp;<a href="#clearMonitorConfig"><?php echo __('Reset to default'); ?></a>
1590 </div>
1591 </div>
1593 <div id="monitorInstructionsDialog" title="<?php echo __('Monitor Instructions'); ?>" style="display:none;">
1594 <?php echo __('The phpMyAdmin Monitor can assist you in optimizing the server configuration and track down time intensive queries. For the latter you will need to set log_output to \'TABLE\' and have either the slow_query_log or general_log enabled. Note however, that the general_log produces a lot of data and increases server load by up to 15%'); ?>
1595 <?php if (PMA_MYSQL_INT_VERSION < 50106) { ?>
1597 <img class="icon ic_s_attention" src="themes/dot.gif" alt="" />
1598 <?php
1599 echo __('Unfortunately your Database server does not support logging to table, which is a requirement for analyzing the database logs with phpMyAdmin. Logging to table is supported by MySQL 5.1.6 and onwards. You may still use the server charting features however.');
1601 </p>
1602 <?php
1603 } else {
1605 <p></p>
1606 <img class="ajaxIcon" src="<?php echo $GLOBALS['pmaThemeImage']; ?>ajax_clock_small.gif" alt="Loading" />
1607 <div class="ajaxContent"></div>
1608 <div class="monitorUse" style="display:none;">
1609 <p></p>
1610 <?php
1611 echo '<strong>';
1612 echo __('Using the monitor:');
1613 echo '</strong><p>';
1614 echo __('Ok, you are good to go! Once you click \'Start monitor\' your browser will refresh all displayed charts in a regular interval. You may add charts and change the refresh rate under \'Settings\', or remove any chart using the cog icon on each respective chart.');
1615 echo '</p><p>';
1616 echo __('To display queries from the logs, select the relevant time span on any chart by holding down the left mouse button and panning over the chart. Once confirmed, this will load a table of grouped queries, there you may click on any occuring SELECT statements to further analyze them.');
1617 echo '</p>';
1620 <img class="icon ic_s_attention" src="themes/dot.gif" alt="" />
1621 <?php
1622 echo '<strong>';
1623 echo __('Please note:');
1624 echo '</strong><br />';
1625 echo __('Enabling the general_log may increase the server load by 5-15%. Also be aware that generating statistics from the logs is a load intensive task, so it is advisable to select only a small time span and to disable the general_log and empty its table once monitoring is not required any more.');
1627 </p>
1628 </div>
1629 <?php } ?>
1630 </div>
1632 <div id="addChartDialog" title="Add chart" style="display:none;">
1633 <div id="tabGridVariables">
1634 <p><input type="text" name="chartTitle" value="<?php echo __('Chart Title'); ?>" /></p>
1636 <input type="radio" name="chartType" value="preset" id="chartPreset" />
1637 <label for="chartPreset"><?php echo __('Preset chart'); ?></label>
1638 <select name="presetCharts"></select><br/>
1640 <input type="radio" name="chartType" value="variable" id="chartStatusVar" checked="checked" />
1641 <label for="chartStatusVar"><?php echo __('Status variable(s)'); ?></label><br/>
1642 <div id="chartVariableSettings">
1643 <label for="chartSeries"><?php echo __('Select series:'); ?></label><br />
1644 <select id="chartSeries" name="varChartList" size="1">
1645 <option><?php echo __('Commonly monitored'); ?></option>
1646 <option>Processes</option>
1647 <option>Questions</option>
1648 <option>Connections</option>
1649 <option>Bytes_sent</option>
1650 <option>Bytes_received</option>
1651 <option>Threads_connected</option>
1652 <option>Created_tmp_disk_tables</option>
1653 <option>Handler_read_first</option>
1654 <option>Innodb_buffer_pool_wait_free</option>
1655 <option>Key_reads</option>
1656 <option>Open_tables</option>
1657 <option>Select_full_join</option>
1658 <option>Slow_queries</option>
1659 </select><br />
1660 <label for="variableInput"><?php echo __('or type variable name:'); ?> </label>
1661 <input type="text" name="variableInput" id="variableInput" />
1662 <p></p>
1663 <input type="checkbox" name="differentialValue" id="differentialValue" value="differential" checked="checked" />
1664 <label for="differentialValue"><?php echo __('Display as differential value'); ?></label><br />
1665 <input type="checkbox" id="useDivisor" name="useDivisor" value="1" />
1666 <label for="useDivisor"><?php echo __('Apply a divisor'); ?></label>
1667 <span class="divisorInput" style="display:none;">
1668 <input type="text" name="valueDivisor" size="4" value="1" />
1669 (<a href="#kibDivisor"><?php echo __('KiB'); ?></a>, <a href="#mibDivisor"><?php echo __('MiB'); ?></a>)
1670 </span><br />
1672 <input type="checkbox" id="useUnit" name="useUnit" value="1" />
1673 <label for="useUnit"><?php echo __('Append unit to data values'); ?></label>
1675 <span class="unitInput" style="display:none;">
1676 <input type="text" name="valueUnit" size="4" value="" />
1677 </span>
1679 <a href="#submitAddSeries"><b><?php echo __('Add this series'); ?></b></a>
1680 <span id="clearSeriesLink" style="display:none;">
1681 | <a href="#submitClearSeries"><?php echo __('Clear series'); ?></a>
1682 </span>
1683 </p>
1684 <?php echo __('Series in Chart:'); ?><br/>
1685 <span id="seriesPreview">
1686 <i><?php echo __('None'); ?></i>
1687 </span>
1688 </div>
1689 </div>
1690 </div>
1692 <!-- For generic use -->
1693 <div id="emptyDialog" title="Dialog" style="display:none;">
1694 </div>
1696 <?php if (!PMA_DRIZZLE) { ?>
1697 <div id="logAnalyseDialog" title="<?php echo __('Log statistics'); ?>" style="display:none;">
1698 <p> <?php echo __('Selected time range:'); ?>
1699 <input type="text" name="dateStart" class="datetimefield" value="" /> -
1700 <input type="text" name="dateEnd" class="datetimefield" value="" /></p>
1701 <input type="checkbox" id="limitTypes" value="1" checked="checked" />
1702 <label for="limitTypes">
1703 <?php echo __('Only retrieve SELECT,INSERT,UPDATE and DELETE Statements'); ?>
1704 </label>
1705 <br/>
1706 <input type="checkbox" id="removeVariables" value="1" checked="checked" />
1707 <label for="removeVariables">
1708 <?php echo __('Remove variable data in INSERT statements for better grouping'); ?>
1709 </label>
1711 <?php
1712 echo '<p>';
1713 echo __('Choose from which log you want the statistics to be generated from.');
1714 echo '</p><p>';
1715 echo __('Results are grouped by query text.');
1716 echo '</p>';
1718 </div>
1720 <div id="queryAnalyzerDialog" title="<?php echo __('Query analyzer'); ?>" style="display:none;">
1721 <textarea id="sqlquery"> </textarea>
1722 <p></p>
1723 <div class="placeHolder"></div>
1724 </div>
1725 <?php } ?>
1727 <table border="0" class="clearfloat" id="chartGrid">
1729 </table>
1730 <div id="logTable">
1731 <br/>
1732 </div>
1734 <script type="text/javascript">
1735 variableNames = [ <?php
1736 $i=0;
1737 foreach ($server_status as $name=>$value) {
1738 if (is_numeric($value)) {
1739 if ($i++ > 0) {
1740 echo ", ";
1742 echo "'" . $name . "'";
1745 ?> ];
1746 </script>
1747 <?php
1750 /* Builds a <select> list for refresh rates */
1751 function refreshList($name, $defaultRate=5, $refreshRates=Array(1, 2, 5, 10, 20, 40, 60, 120, 300, 600))
1754 <select name="<?php echo $name; ?>" id="id_<?php echo $name; ?>">
1755 <?php
1756 foreach ($refreshRates as $rate) {
1757 $selected = ($rate == $defaultRate)?' selected="selected"':'';
1759 if ($rate<60) {
1760 echo '<option value="' . $rate . '"' . $selected . '>' . sprintf(_ngettext('%d second', '%d seconds', $rate), $rate) . '</option>';
1761 } else {
1762 echo '<option value="' . $rate . '"' . $selected . '>' . sprintf(_ngettext('%d minute', '%d minutes', $rate/60), $rate/60) . '</option>';
1766 </select>
1767 <?php
1771 * cleanup of some deprecated values
1773 * @param array &$server_status
1775 function cleanDeprecated(&$server_status)
1777 $deprecated = array(
1778 'Com_prepare_sql' => 'Com_stmt_prepare',
1779 'Com_execute_sql' => 'Com_stmt_execute',
1780 'Com_dealloc_sql' => 'Com_stmt_close',
1783 foreach ($deprecated as $old => $new) {
1784 if (isset($server_status[$old]) && isset($server_status[$new])) {
1785 unset($server_status[$old]);
1791 * Sends the footer
1793 require './libraries/footer.inc.php';