Heim > php教程 > php手册 > Hauptteil

在php中集成xdebug(windows平台)

WBOY
Freigeben: 2016-06-13 09:37:30
Original
1328 Leute haben es durchsucht

首先到http://xdebug.org/download.php上面去下载xdebug,如果不知道下载哪一个,那么到http://xdebug.org/wizard.php上面,将你跑PHPinfo时显示出来网页的源代码,copy到上面网址显示出来的文本框中,点击“analyse my phpinfo() output”按钮,即可以输出来你系统上面装的php的信息,比如我的显示出来的是这样

Summary

  • Xdebug installed: no
  • Server API: Apache 2.0 Handler
  • Windows: yes - Compiler: MS VC9 - Architecture: x86
  • Zend Server: no
  • PHP Version: 5.4.24
  • Zend API nr: 220100525
  • PHP API nr: 20100525
  • Debug Build: no
  • Thread Safe Build: yes
  • Configuration File Path: C:\Windows
  • Configuration File: D:\php-5.4.24-Win32-VC9-x86\php.ini
  • Extensions directory: D:\php-5.4.24-Win32-VC9-x86\ext

    Instructions

    1. Download php_xdebug-2.2.3-5.4-vc9.dll
    2. Move the downloaded file to D:\php-5.4.24-Win32-VC9-x86\ext
    3. Edit D:\php-5.4.24-Win32-VC9-x86\php.ini and add the line
      zend_extension = D:\php-5.4.24-Win32-VC9-x86\ext\php_xdebug-2.2.3-5.4-vc9.dll
    4. Restart the webserver
  • 那么即可以按照这个步骤进行配置。除此之外,还可以在php.ini配置中加入如下一些扩展信息
    zend_extension="D:\php\ext\php_xdebug.dll"
    xdebug.profiler_output_dir="D:\php53\xdebug"
    xdebug.profiler_enable=On
    xdebug.profiler_enable_trigger=1
    xdebug.default_enable=On
    xdebug.show_exception_trace=On
    xdebug.show_local_vars=1
    xdebug.max_nesting_level=50
    xdebug.var_display_max_depth=6
    xdebug.dump_once=On
    xdebug.dump_globals=On
    xdebug.dump_undefined=On
    xdebug.dump.REQUEST=*
    xdebug.dump.SERVER=REQUEST_METHOD,REQUEST_URI,HTTP_USER_AGENT
    xdebug.trace_output_dir="D:\php53\xdebug"
    各配置的一些说明信息如下
    xdebug.default_enable
    类型:布尔型 默认值:On
    如果这项设置为On,堆栈跟踪将被默认的显示在错误事件中。你可以通过在代码中使用xdebug_disable()来禁止堆叠跟踪的显示。因为这是xdebug基本功能之一,将这项参数设置为On是比较明智的。

    xdebug.max_nesting_level
    类型:整型 默认值:100
    The value of this setting is the maximum level of nested functions that are allowed before the script will be aborted.
    限制无限递归的访问深度。这项参数设置的值是脚本失败前所允许的嵌套程序的最大访问深度。

    xdebug.dump_globals
    类型:布尔型 默认值:1
    限制是否显示被xdebug.dump.*设置定义的超全局变量的值
    例如,xdebug.dump.SERVER = REQUEST_METHOD,REQUEST_URI,HTTP_USER_AGENT 将打印 PHP 超全局变量 $_SERVER['REQUEST_METHOD']、$_SERVER['REQUEST_URI'] 和 $_SERVER['HTTP_USER_AGENT']。

    xdebug.dump_once
    类型:布尔型 默认值:1
    限制是否超全局变量的值应该转储在所有出错环境(设置为Off时)或仅仅在开始的地方(设置为On时)

    xdebug.dump_undefined
    类型:布尔型 默认值:0
    如果你想从超全局变量中转储未定义的值,你应该把这个参数设置成On,否则就设置成Off

    xdebug.show_exception_trace
    类型:整型 默认值:0
    当这个参数被设置为1时,即使捕捉到异常,xdebug仍将强制执行异常跟踪当一个异常出现时。

    xdebug.show_local_vars
    类型:整型 默认值:0
    当这个参数被设置为不等于0时,xdebug在错环境中所产生的堆栈转储还将显示所有局部变量,包括尚未初始化的变量在最上面。要注意的是这将产生大量的信息,也因此默认情况下是关闭的。


    xdebug.profiler_append
    类型:整型 默认值:0
    当这个参数被设置为1时,文件将不会被追加当一个新的需求到一个相同的文件时(依靠xdebug.profiler_output_name的设置)。相反的设置的话,文件将被附加成一个新文件。

    xdebug.profiler_enable
    类型:整型 默认值:0
    开放xdebug文件的权限,就是在文件输出目录中创建文件。那些文件可以通过KCacheGrind来阅读来展现你的数据。这个设置不能通过在你的脚本中调用ini_set()来设置。

    xdebug.profiler_output_dir
    类型:字符串 默认值:/tmp
    这个文件是profiler文件输出写入的,确信PHP用户对这个目录有写入的权限。这个设置不能通过在你的脚本中调用ini_set()来设置。

    xdebug.profiler_output_name
    类型:字符串 默认值:cachegrind.out%p
    这个设置决定了转储跟踪写入的文件的名称。

    远程Debug
    相关参数设置
    xdebug.remote_autostart
    类型:布尔型 默认值:0
    一般来说,你需要使用明确的HTTP GET/POST变量来开启远程debug。而当这个参数设置为On,xdebug将经常试图去开启一个远程debug session并试图去连接客户端,即使GET/POST/COOKIE变量不是当前的。

    xdebug.remote_enable
    类型:布尔型 默认值:0
    这个开关控制xdebug是否应该试着去连接一个按照xdebug.remote_host和xdebug.remote_port来设置监听主机和端口的debug客户端。

    xdebug.remote_host
    类型:字符串 默认值:localhost
    选择debug客户端正在运行的主机,你不仅可以使用主机名还可以使用IP地址

    xdebug.remote_port
    类型:整型 默认值:9000
    这个端口是xdebug试着去连接远程主机的。9000是一般客户端和被绑定的debug客户端默认的端口。许多客户端都使用这个端口数字,最好不要去修改这个设置。
    注意在配置xdebug之前,如果配置过ZendOptimizer,需要先屏蔽ZendOptimizer 有关的配置,通常如下:
    [Zend]
    zend_extension_manager.optimizer_ts="path\ZendOptimizer-3.3.0\lib\Optimizer-3.3.0"
    zend_extension_ts="path\ZendOptimizer-3.3.0\lib\ZendExtensionManager.dll"  

    Verwandte Etiketten:
    Quelle:php.cn
    Erklärung dieser Website
    Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn
    Beliebte Empfehlungen
    Beliebte Tutorials
    Mehr>
    Neueste Downloads
    Mehr>
    Web-Effekte
    Quellcode der Website
    Website-Materialien
    Frontend-Vorlage
    Über uns Haftungsausschluss Sitemap
    Chinesische PHP-Website:Online-PHP-Schulung für das Gemeinwohl,Helfen Sie PHP-Lernenden, sich schnell weiterzuentwickeln!