address of the mysql host * 'username' => mysql user * 'password' => password of the mysql user * ); */ $CONFIG = array( 'hostname' => 'localhost', 'username' => 'root', 'password' => '' ); // connect to database $conn = @mysql_connect( $CONFIG['hostname'], $CONFIG['username'], $CONFIG['password'] ); if (!$conn) { die("FAILURE: ". mysql_error() ."\n"); } // run query $sql = "SHOW STATUS"; $result = @mysql_query( $sql ); if (!$result) { die("FAILURE: " . mysql_error() ."\n"); } else { while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) { $status[ $row['Variable_name'] ] = $row['Value']; } echo "OK: Mysql Server Uptime ". $status['Uptime'] ." seconds \n"; } // close connection mysql_close($conn); ?>