一.安装
xhprof
1.brew install homebrew/php/php56-xhprof
2.phpinfo看是否已经添加扩展
3. xhprof.ini 配置
[xhprof]
extension="/usr/local/opt/php56-xhprof/xhprof.so"
xhprof.output_dir="/data/xhprof"
4.重启 apche
二. xhprof gui
有xhprof自带的工具度娘遍地都是。
1.xhprof gui 下载地址 https://github.com/preinheimer/xhprof
2.配置 看文档吧
// Change these:
$_xhprof['dbtype'] = 'mysql'; // Only relevant for PDO
$_xhprof['dbhost'] = 'localhost';
$_xhprof['dbuser'] = 'root';
$_xhprof['dbpass'] = 'root';
$_xhprof['dbname'] = 'xhprof';
$_xhprof['dbadapter'] = 'Pdo';
$_xhprof['servername'] = 'myserver';
$_xhprof['namespace'] = 'myapp';
$_xhprof['url'] = 'http://localhost/xhprof/xhprof_html';
$_xhprof['getparam'] = "_profile";
注意:你要建立数据库 文档里有 数据库报错 server_id to long 我改了长了
php.ini 里配置
auto_prepend_file = "/Applications/XAMPP/www/localhost/xhprof/external/header.php"
http://localhost/xhprof/xhprof_html 是你本地搭建的web环境
使用: www.xxx.com?_profile=1
_profile会保存在cookie里