dongxiatuo9827 2013-11-05 13:32
浏览 153
已采纳

使用XHProf和XHGui时出错

I have installed and configured XHGui as per the instructions here:

http://www.sitepoint.com/the-need-for-speed-profiling-with-xhprof-and-xhgui/

However, when I try to profile a page I see an error inserting into the details table (have truncated this as there is a large string of binary/compressed data):

Failed to insert: INSERT INTO `details` (`id`, `url`, `c_url`, `timestamp`, `server name`, `perfdata`, `type`, `cookie`, `post`, `get`, `pmu`, `wt`, `cpu`, `server_id`, `aggregateCalls_include`) VALUES('5278f06a19b9d', '/whats-on/?', '/whats-on/?', FROM_UNIXTIME('1383657576'), 'local.site2', 'x^���r$Iv%
�K?����v����/?���������-��-�����~��j�\\/�g��>��X����O���~���o��mv���������������r9�p~�=��_��>�N_���jI�/�Wt�bqX�������Sy��S��K�u��:?g��K�6��p�����ӇOw�_>ষ�˄;.|�%��X���;n�>�����������-A\0ܞ/��
\Z����������;C��om?;|a %5\0^�p��+z��A���rk��×�a��L\'OFю@X8�\"��7���ah=���J�\'
��Q���?�0�?��b\ZN�����rzz�����ߝ�O�Al=7�

I believe zlib compression is being used and that my PHP install was compiled with zlib support:

'./configure' '--prefix=/usr/local/php5' '--with-apxs2=/usr/sbin/apxs' '--with-config-file-scan-dir=/usr/local/php5/php.d' '--with-openssl=/usr' '--with-zlib=/usr' '--with-zlib-dir=/usr' '--with-gd' '--with-ldap' '--with-xmlrpc' '--enable-exif' '--enable-soap' '--enable-sqlite-utf8' '--enable-wddx' '--enable-ftp' '--enable-sockets' '--with-bz2=/usr' '--enable-zip' '--enable-shmop' '--enable-sysvsem' '--enable-sysvshm' '--enable-sysvmsg' '--enable-mbstring' '--enable-bcmath' '--enable-calendar' '--with-iodbc' '--with-mhash' '--enable-fpm' '--with-mysql=mysqlnd' '--with-mysqli=mysqlnd' '--with-pdo-mysql=mysqlnd' '--enable-pcntl' '--enable-dtrace' '--with-icu-dir=/usr/local/php5' '--with-mssql=shared,/usr/local/php5' '--with-pdo-dblib=shared,/usr/local/php5' '--with-libxml-dir=shared,/usr/local/php5' '--with-xsl=shared,/usr/local/php5' '--with-imap=../imap-2007f' '--with-kerberos=/usr' '--with-imap-ssl=/usr' '--with-gettext=/usr/local/php5' '--with-curl=shared,/usr/local/php5' '--with-png-dir=/usr/local/php5' '--with-jpeg-dir=/usr/local/php5' '--enable-gd-native-ttf' '--with-freetype-dir=/usr/local/php5' '--with-pgsql=shared,/usr/local/php5' '--with-pdo-pgsql=shared,/usr/local/php5' '--with-mcrypt=shared,/usr/local/php5' '--with-tidy=/usr/local/php5' '--with-gmp=shared,/usr/local/php5' '--with-readline=shared,/usr/local/php5'

Anyone seen this before or know what is going on? Its running on localhost (Mountain Lion with Liip OSX PHP - PHP 5.4

UPDATE

I increased the server_id field length and ran the profile again. Now getting:

Incorrect integer value: '' for column 'pmu' at row 1 as a result of this query:

INSERT INTO `details` (`id`, `url`, `c_url`, `timestamp`, `server name`, `perfdata`, `type`, `cookie`, `post`, `get`, `pmu`, `wt`, `cpu`, `server_id`, `aggregateCalls_include`) VALUES('5279085839571', '/whats-on/?', '/whats-on/?', FROM_UNIXTIME('1383663629'), 'local.mysitename', 'x^��\0\0�\0�', '1', 'a:1:{s:8:\"_profile\";s:1:\"1\";}', 'a:0:{}', 'a:0:{}', '', '', '', 'localhost', '') 

SHOW CREATE TABLE:

CREATE TABLE `details` (
  `id` char(17) NOT NULL,
  `url` varchar(255) DEFAULT NULL,
  `c_url` varchar(255) DEFAULT NULL,
  `timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `server name` varchar(64) DEFAULT NULL,
  `perfdata` mediumblob,
  `type` tinyint(4) DEFAULT NULL,
  `cookie` blob,
  `post` blob,
  `get` blob,
  `pmu` int(11) unsigned DEFAULT NULL,
  `wt` int(11) unsigned DEFAULT NULL,
  `cpu` int(11) unsigned DEFAULT NULL,
  `server_id` char(3) NOT NULL DEFAULT 't11',
  `aggregateCalls_include` varchar(255) DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `url` (`url`),
  KEY `c_url` (`c_url`),
  KEY `cpu` (`cpu`),
  KEY `wt` (`wt`),
  KEY `pmu` (`pmu`),
  KEY `timestamp` (`timestamp`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
  • 写回答

1条回答 默认 最新

  • duanmao1872 2013-11-05 14:34
    关注

    A few questions:

    • What database backend is PDO using? MySQL? Other? If it's MySQL try the MySQL(i) adapter? Data is being stored in MySQL
    • If you copy/paste the query (omitting the blob data for simplicity) does the query execute, or even get a more verbose error? Does it just work?
    • Does the backend you're using support blob nicely? MySQL Does
    • Can you show the SHOW CREATE TABLE for your details table?

    I don't think the compression is the issue, it would have failed earlier, like around here: https://github.com/preinheimer/xhprof/blob/master/xhprof_lib/utils/xhprof_runs.php#L434

    Taking your updated SHOW CREATE TABLE and query, I get:

    Database changed
    mysql> CREATE TABLE `details` (
        ->   `id` char(17) NOT NULL,
        ->   `url` varchar(255) DEFAULT NULL,
        ->   `c_url` varchar(255) DEFAULT NULL,
        ->   `timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
        ->   `server name` varchar(64) DEFAULT NULL,
        ->   `perfdata` mediumblob,
        ->   `type` tinyint(4) DEFAULT NULL,
        ->   `cookie` blob,
        ->   `post` blob,
        ->   `get` blob,
        ->   `pmu` int(11) unsigned DEFAULT NULL,
        ->   `wt` int(11) unsigned DEFAULT NULL,
        ->   `cpu` int(11) unsigned DEFAULT NULL,
        ->   `server_id` char(3) NOT NULL DEFAULT 't11',
        ->   `aggregateCalls_include` varchar(255) DEFAULT NULL,
        ->   PRIMARY KEY (`id`),
        ->   KEY `url` (`url`),
        ->   KEY `c_url` (`c_url`),
        ->   KEY `cpu` (`cpu`),
        ->   KEY `wt` (`wt`),
        ->   KEY `pmu` (`pmu`),
        ->   KEY `timestamp` (`timestamp`)
        -> ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
    Query OK, 0 rows affected (0.01 sec)
    
    mysql> INSERT INTO `details` (`id`, `url`, `c_url`, `timestamp`, `server name`, `perfdata`, `type`, `cookie`, `post`, `get`, `pmu`, `wt`, `cpu`, `server_id`, `aggregateCalls_include`) VALUES('5279085839571', '/whats-on/?', '/whats-on/?', FROM_UNIXTIME('1383663629'), 'local.mysitename', 'x^��\0\0�\0�', '1', 'a:1:{s:8:\"_profile\";s:1:\"1\";}', 'a:0:{}', 'a:0:{}', '', '', '', 'localhost', '') ;
    Query OK, 1 row affected, 4 warnings (0.00 sec)
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥20 关于#硬件工程#的问题,请各位专家解答!
  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 報錯:Person is not mapped,如何解決?
  • ¥15 c++头文件不能识别CDialog
  • ¥15 Excel发现不可读取的内容