xdebug简介

Xdebug是php的一款调试工具,是基于zend的一个扩展,可以用来跟踪,调试和分析PHP程序的运行状况。如变量,函数调试,性能监测,代码覆盖率等


xdebug安装

1.下载xdebug源程序

git clone git://github.com/xdebug/xdebug.git
https://xdebug.org/download.php#releases

2.解压xdebug包

tar -xzvf xdebug.tgz

3.进入解压目录

cd xdebug

4.运行phpize

/usr/local/php/bin/phpize

5.编译

./configure --enable-xdebug --with-php-config=/usr/local/php/bin/php-config

6.安装

make && make install

7.安装成功后会在php扩展目录生成类似xdebug.so的扩展

8.安装xdebug客户端xdebugclient (需要libedit扩展)

cd debugclient
./configure --with-libedit
make
make install

xdebug配置

1.在php.ini配置文件中添加如下内容

zend_extension="/wherever/you/put/it/xdebug.so"

2.如果是php5.3之前版本线程安全,添加如下内容代替上面1的内容

zend_extension_ts="/wherever/you/put/it/xdebug.so"

3.自从php5.3之后zend_extension_ts, zend_extension_debug不再使用

4.xdebug的一些其他配置

;显示错误信息
xdebug.default_enable = 1 ;函数调试
xdebug.auto_trace=on
xdebug.trace_output_dir
xdebug.trace_output_name
;Type: string, Default value: trace.%c
xdebug.collect_params = 1|3|4 (参数长度,参数值,参数=值)
xdebug.show_mem_delta=1 显示内存
xdebug.collect_return=1 显示返回值
xdebug.trace_options =1 追加日志
xdebug.collect_params=1
xdebug.collect_vars = 1 ;开启性能分析
xdebug.profiler_enable=1
;性能分析日志保存目录
xdebug.profiler_output_dir = /data/logs/xdebug/
;性能分析日志文件名称
xdebug.profiler_output_name = cachegrind.out.log
;默认是如下格式,t时间,p进程id
;xdebug.profiler_output_name = cachegrind.out.%t.%p ;代码覆盖率
xdebug.coverage_enable = 1 ;以下是远程调试配置
xdebug.remote_host= 127.0.0.1
xdebug.remote_connect_back = 1
xdebug.remote_port = 9000
xdebug.remote_log="/data/logs/xdebug/xdebug.log"

4.重启php使配置生效


性能分析日志工具

1.linux平台

工具KCacheGrind (Linux, KDE) https://kcachegrind.github.io/

2.win平台查看工具WinCacheGrind

相关网址

http://ceefour.github.io/wincachegrind/
https://sourceforge.net/projects/wincachegrind/
https://github.com/ceefour/wincachegrind/releases/tag/1.1

列名称含义

Self - Shows the execution time of the code in the current block

Cum. - Shows the total exuction time of functions that the current function (Self) calls

Avg vs. Total: Average is average time per call, Total is the total time spend in all calls.

3.Web方式查看webgrind

https://github.com/jokkedk/webgrind

linux下php调试工具xdebug安装配置的更多相关文章

  1. PHP 调试工具Xdebug安装配置

    ## PHP 调试工具Xdebug安装配置 一.Xdebug 介绍 Xdebug是一个开源的PHP程序调试工具,可以使用它来调试.跟踪及分析程序运行状态.当然,Xdebug需要结合PHP的编辑工具来打 ...

  2. Linux下apache+phppgadmin+postgresql安装配置

    Linux下apache+phppgadmin+postgresql安装配置 操作系统:CentOS 安装包:httpd(首选yum), php(包括php以及php-pgsql,php-mbstri ...

  3. PHP调试工具Xdebug安装配置教程

    说道PHP代码调试,对于有经验的PHPer,通过echo.print_r.var_dump函数,或PHP开发工具zend studio.editplus可解决大部分问题,但是对于PHP入门学习的童鞋来 ...

  4. PHP性能调优---PHP调试工具Xdebug安装配置教程

    说到PHP代码调试,对于有经验的PHPer,通过echo.print_r.var_dump函数,或PHP开发工具zend studio.editplus可解决大部分问题,但是对于PHP入门学习的童鞋来 ...

  5. Linux下xampp集成环境安装配置方法 、部署bugfree及部署禅道

    XAMPP(Apache+MySQL+PHP+PERL)是一个功能强大的建站集成软件包.XAMPP 是一个易于安装且包含 MySQL.PHP 和 Perl 的 Apache 发行版.XAMPP 的确非 ...

  6. Windows和Linux下apache-artemis-2.10.0安装配置

     window下安装配置 一.官网下载 http://activemq.apache.org/artemis/download.html 二.百度网盘下载 链接:https://pan.baidu.c ...

  7. linux下xampp集成包安装配置方法

    1.查看你linux系统的位数,是32位的还是64位的.使用uname -a命令查看. 显示有 x86_64则说明你是64位内核, 跑的是64位的系统. i386, i686说明你是32位的内核, 跑 ...

  8. linux下Django Nginx+uwsgi 安装配置

    原文链接 在前面的章节中我们使用 python manage.py runserver 来运行服务器.这只适用测试环境中使用. 正式发布的服务,我们需要一个可以稳定而持续的服务器,比如apache, ...

  9. Python 虚拟环境 | Mac/Linux下如何避坑安装配置Virtualenv

    1.为什么要使用虚拟环境 在Python中,不同的应用可能需要用到不同版本的第三方包,而这些第三方包被统一存放到目录site-packages中,不同版本的包容易相互覆盖,如安装Django 2.1时 ...

随机推荐

  1. leetcode--012 single number I

    aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAA0MAAADGCAIAAACfN8xOAAAZ6UlEQVR4nO3dsZKcurbG8fNOnd1nIv

  2. AJAX异步加载

    AJAX含义: 即"Asynchronous Javascript And XML"(异步JavaScript和XML),是指一种创建交互式网页应用的网页开发技术. AJAX可以跨 ...

  3. 分30条依次解析xml并插入数据库成功

    package xxx; import java.util.ArrayList; import java.util.Iterator; import java.util.List; import or ...

  4. struts2默认Action配置

    在项目中,需要在输入错误的url的时候,弹出友好的错误提示页面 在struts2中可以通过配置默认的action达到这个目的 配置方法: <package name="default& ...

  5. 微信网页授权redirect_uri错误的可能错误之一

    授权回调页面域名 后面不要加/ 加了/ 就会出错.

  6. C# Winform窗口之间传值的多种方法浅析(转)

    摘要http://www.jb51.net/article/63837.htm 这篇文章主要介绍了C# Winform窗口之间传值的多种方法浅析,本文起讲解了通过构造器传值.通过属性传递.通过事件携带 ...

  7. js原生写的微博留言板有angularjs效果

    1.HTML: <!DOCTYPE html><html><head lang="en">    <meta charset=" ...

  8. 获取打开文件的PID

    var SI : TStartupInfo; PI : TProcessInformation; pid:DWORD; begin ZeroMemory(@SI, SizeOf(SI)); //Zer ...

  9. 使用Intent创建Tab页面

    前面已经介绍了如何使用TabActivity来创建Activity布局,前面添加Tab页面使用了TabHost.TabSpec如下方法. setContent(int viewId):直接将指定Vie ...

  10. C++中的RAII技法

    Resource Acquisition Is Initialization or RAII, is a C++ programming technique which binds the life ...