在Ubuntu服务器上安装XHProf

4

我已经尝试了以下教程以及其他一些教程:

http://akyl.net/how-install-xhprof-profiler-ubuntu

http://erichogue.ca/2011/03/linux/profiling-a-php-application/

我不断收到以下错误信息:

running: make
/bin/bash /tmp/pear/install/pear-build-fieldnation1Iqjyy/xhprof-0.9.2/libtool --mode=compile cc  -I. -I/tmp/pear/install/xhprof/extension -DPHP_ATOM_INC -I/tmp/pear/install/pear-build-fieldnation1Iqjyy/xhprof-0.9.2/include -I/tmp/pear/install/pear-build-fieldnation1Iqjyy/xhprof-0.9.2/main -I/tmp/pear/install/xhprof/extension -I/usr/include/php5 -I/usr/include/php5/main -I/usr/include/php5/TSRM -I/usr/include/php5/Zend -I/usr/include/php5/ext -I/usr/include/php5/ext/date/lib -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64  -DHAVE_CONFIG_H  -g -O2   -c /tmp/pear/install/xhprof/extension/xhprof.c -o xhprof.lo
libtool: compile:  cc -I. -I/tmp/pear/install/xhprof/extension -DPHP_ATOM_INC -I/tmp/pear/install/pear-build-fieldnation1Iqjyy/xhprof-0.9.2/include -I/tmp/pear/install/pear-build-fieldnation1Iqjyy/xhprof-0.9.2/main -I/tmp/pear/install/xhprof/extension -I/usr/include/php5 -I/usr/include/php5/main -I/usr/include/php5/TSRM -I/usr/include/php5/Zend -I/usr/include/php5/ext -I/usr/include/php5/ext/date/lib -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -DHAVE_CONFIG_H -g -O2 -c /tmp/pear/install/xhprof/extension/xhprof.c  -fPIC -DPIC -o .libs/xhprof.o
In file included from /usr/include/php5/main/php.h:33:0,
                 from /tmp/pear/install/xhprof/extension/xhprof.c:27:
/usr/include/php5/main/php_config.h:2396:0: warning: "_GNU_SOURCE" redefined [enabled by default]
/tmp/pear/install/xhprof/extension/xhprof.c:24:0: note: this is the location of the previous definition
/tmp/pear/install/xhprof/extension/xhprof.c:236:1: warning: 'visibility' attribute ignored [-Wattributes]
/tmp/pear/install/xhprof/extension/xhprof.c:240:28: warning: 'visibility' attribute ignored [-Wattributes]
/tmp/pear/install/xhprof/extension/xhprof.c: In function 'hp_get_function_name':
/tmp/pear/install/xhprof/extension/xhprof.c:898:10: warning: assignment discards 'const' qualifier from pointer target type [enabled by default]
/tmp/pear/install/xhprof/extension/xhprof.c:909:13: warning: assignment discards 'const' qualifier from pointer target type [enabled by default]
/tmp/pear/install/xhprof/extension/xhprof.c:911:13: warning: assignment discards 'const' qualifier from pointer target type [enabled by default]
/tmp/pear/install/xhprof/extension/xhprof.c:930:34: error: 'znode_op' has no member named 'u'
/tmp/pear/install/xhprof/extension/xhprof.c:963:9: warning: passing argument 1 of 'hp_get_base_filename' discards 'const' qualifier from pointer target type [enabled by default]
/tmp/pear/install/xhprof/extension/xhprof.c:856:14: note: expected 'char *' but argument is of type 'const char *'
/tmp/pear/install/xhprof/extension/xhprof.c: In function 'hp_execute_internal':
/tmp/pear/install/xhprof/extension/xhprof.c:1650:24: error: 'znode_op' has no member named 'u'
/tmp/pear/install/xhprof/extension/xhprof.c:1651:59: error: 'struct <anonymous>' has no member named 'return_reference'
/tmp/pear/install/xhprof/extension/xhprof.c:1652:25: error: 'znode_op' has no member named 'u'
/tmp/pear/install/xhprof/extension/xhprof.c: In function 'hp_compile_file':
/tmp/pear/install/xhprof/extension/xhprof.c:1683:3: warning: passing argument 1 of 'hp_get_base_filename' discards 'const' qualifier from pointer target type [enabled by default]
/tmp/pear/install/xhprof/extension/xhprof.c:856:14: note: expected 'char *' but argument is of type 'const char *'
make: *** [xhprof.lo] Error 1
ERROR: `make' failed

基本上,'make' 无法运行。我该怎么办才能解决这个问题?

你是通过pecl来安装它的吗? - Connor McArthur
我运行了 pecl install xhprof,但最终出现了上述错误。 - Nicholas Yost
我也遇到了这个错误。你最后解决了吗? - RaisinBranCrunch
很遗憾,我不记得为什么想要这个了,但我也不记得是否已经解决了。这么长时间过去了,我想现在它可能已经过时了。PECL列表显示它已经有将近4年没有更新了,而且我正在使用PHP7+进行所有新的开发,所以我甚至不知道这是否是我目前用于分析的工具。抱歉!如果你找到了,请在这里回复,我会接受它作为解决方案! - Nicholas Yost
2个回答

1

我遇到了同样的问题,按照以下步骤解决:

下载 "xhprof" 软件包:

  • cd /extension/
  • phpize
  • ./configure --with-php-config=
  • make
  • make install
  • make test

现在,在 php.ini 文件中添加以下行:

  • [xhprof]
  • extension=xhprof.so
  • xhprof.output_dir="directory_for_storing_xhprof_runs"
现在:apache重启

0

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接