XDebug - profiling your php code

任何疑问请加QQ:79811993

Install PEAR

=========================

1. 下载pear

curl -O http://pear.php.net/go-pear.phar

2. 安装pear

sudo php -d detect_unicode=0 go-pear.phar

3. 执行以上命令后会进行安装过程,会有一些配置选项

输入1,回车,配置pear路径为:/usr/local/pear

输入4,回车,配置命令路径为:/usr/local/bin

4.回车两次,其他让其默认,安装完成

扫描二维码关注公众号,回复: 2253784 查看本文章

5. 可以通过命令检查pear安装是否成功`pear version`

Install XDebug

=========================

sudo pecl install xdebug

http://xdebug.org/install.php#configure-php

Build process completed successfully

Installing '/usr/local/Cellar/php/7.2.6/pecl/20170718/xdebug.so'

install ok: channel://pecl.php.net/xdebug-2.6.0

Extension xdebug enabled in php.ini

通过phpinfo查看结果:

Config Xdebug

=========================

vi /usr/local/etc/php/7.2/conf.d/ext-xdebug.ini

[xdebug]

zend_extension="/usr/local/Cellar/php/7.2.6/pecl/20170718/xdebug.so"

xdebug.auto_trace = On

xdebug.profiler_enable = 1

xdebug.profiler_enable_trigger = 1

View Result using Webgrind

=========================

https://github.com/jokkedk/webgrind

  1. Download webgrind
  2. Unzip package to favourite path accessible by webserver.
  3. Load webgrind in browser and start profiling

http://localhost/PHPTools/webgrind-1.5.0/

see callInfo

=========================

need dot(contain in graphviz) and python

brew install graphviz

brew install python

猜你喜欢

转载自blog.csdn.net/hanjingjava/article/details/81076192
今日推荐