mac xhprof 安装与使用

论坛 期权论坛 脚本     
已经匿名di用户   2022-4-26 16:02   2251   0

用xhprof来查看性能变化实在是php开发必备工具,就把自己安装使用的过程分享给大家。也算是自己的笔记。

  1. 前面的扩展的安装都太普遍就不截图了。

    不解释,先下载解压:

    wget http://pecl.php.net/get/xhprof-0.9.4.tgz

    tar zxvf xhprof-0.9.4.tgz

  2. 需要注意,需要进入到extension目录里执行phpize

    cd xhprof-0.9.4/extension/

    phpize

  3. 但是 我在执行 phpize 遇到一个问题

  4. 提示cannot find autoconf 然后我使劲谷歌 终于知道了问题的所在 便使用了最暴力的办法 brew install autoconf 来解决这个问题

  5. /configure --enable-xhprof ./configure --with-php-config=/Application/MAMP/bin/php/php5.6.10/bin/php-config 注意 config =后面的参数所指你的PHP安装目录

  6. 最后make

  7. make install

  8. 如果你安装成功 便会有 Installing shared extensions: /Applications/MAMP/bin/php/php5.6.10/lib/php/extensions/no-debug-non-zts-20131226/ 这样的提示

  9. 打开你的ini 文件

  10. [xhprof]
    MAMP_Xhprof_MAMP
    extension=xhprof.so
    xhprof.output_dir=/tmp/yhh

  11. 如果 你安装xhprof成功 打开PHPinfo 发现没有加载成功 那就有可能 你下载的xhprof 扩展版本 与你当前PHP 版本无法匹配 打开error 日志文件

  12. 出现这样的 [07-Feb-2017 16:45:02 Asia/Shanghai] PHP Warning: PHP Startup: xhprof: Unable to initialize module
    Module compiled with module API=20131226
    PHP compiled with module API=20121212
    These options need to match 那边是xhprof 扩展版本 与你当前PHP 版本无法匹配

转载于:https://my.oschina.net/u/3255138/blog/833505

分享到 :
0 人收藏
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

积分:81
帖子:4969
精华:0
期权论坛 期权论坛
发布
内容

下载期权论坛手机APP