php5.4之后安装xhprof出现make: * [xhprof.lo] Error 1

本文提供了解决XHProf在PHP5.4环境下安装失败的具体步骤。通过从GitHub下载源码包并手动编译安装,可以避免使用PECL遇到的问题。此外,还介绍了如何配置php.ini启用XHProf模块。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

php5.4之后安装xhprof出现make: * [xhprof.lo] Error 1

百度有点坑,
卡了一会儿后在yahoo上搜到了解决方案,
在这写个备忘。
原帖地址:https://github.com/facebook/xhprof/commit/a6bae51236.diff

We use xhprof to profile our web application framework. The pecl
installer was failing with [xhprof.lo] Error 1 in the make phase
with PHP 5.4. Here’s how to fix that.

Currently, trying sudo pecl install xhprof-beta throws the following
errors in the make phase for PHP >= 5.4:

In file included from /usr/include/php5/main/php.h:33:0, from
/tmp/pear/temp/xhprof/extension/xhprof.c:27:
/usr/include/php5/main/php_config.h:2396:0: warning: “_GNU_SOURCE”
redefined [enabled by default]
/tmp/pear/temp/xhprof/extension/xhprof.c:24:0: note: this is the
location of the previous definition
/tmp/pear/temp/xhprof/extension/xhprof.c:236:1: warning: ‘visibility’
attribute ignored [-Wattributes]
/tmp/pear/temp/xhprof/extension/xhprof.c:240:28: warning: ‘visibility’
attribute ignored [-Wattributes]
/tmp/pear/temp/xhprof/extension/xhprof.c: In function
‘hp_get_function_name’:
/tmp/pear/temp/xhprof/extension/xhprof.c:898:10: warning: assignment
discards ‘const’ qualifier from pointer target type [enabled by
default] /tmp/pear/temp/xhprof/extension/xhprof.c:909:13: warning:
assignment discards ‘const’ qualifier from pointer target type
[enabled by default] /tmp/pear/temp/xhprof/extension/xhprof.c:911:13:
warning: assignment discards ‘const’ qualifier from pointer target
type [enabled by default]
/tmp/pear/temp/xhprof/extension/xhprof.c:930:34: error: ‘znode_op’ has
no member named ‘u’ /tmp/pear/temp/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/temp/xhprof/extension/xhprof.c:856:14: note: expected ‘char
’ but argument is of type ‘const char ’ /tmp/pear/temp/xhprof/extension/xhprof.c: In function
‘hp_execute_internal’:
/tmp/pear/temp/xhprof/extension/xhprof.c:1650:24: error: ‘znode_op’
has no member named ‘u’
/tmp/pear/temp/xhprof/extension/xhprof.c:1651:59: error: ‘struct
’ has no member named ‘return_reference’
/tmp/pear/temp/xhprof/extension/xhprof.c:1652:25: error: ‘znode_op’
has no member named ‘u’ /tmp/pear/temp/xhprof/extension/xhprof.c: In
function ‘hp_compile_file’:
/tmp/pear/temp/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/temp/xhprof/extension/xhprof.c:856:14: note: expected ‘char
’ but argument is of type ‘const char ’ make: * [xhprof.lo] Error 1 ERROR: `make’ failed

According to a PHP bug report, this issue was fixed by Facebook but
not made available on pecl, so you will need to install from the
xhprof github repo, like so:

wget https://github.com/facebook/xhprof/archive/master.zip
unzip master.zip
./configure
make
sudo make install

And enable the module in your php.ini, where xhprof.output_dir is
the directory into which profiles will be generated.

[xhprof] extension=xhprof.so
xhprof.output_dir="/var/tmp/xhprof"

And restart apache, with either of the following two: sudo service
apache2 restart
or
sudo apachectl graceful

Existing users who have upgraded to PHP 5.4 may opt for this xhprof-0.9.2 patch.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值