Windows下XDebug 手工配置与使用说明
XDebug 是一个 php 代码的调试工具, 对程序员调试程序有很大的帮助, 下面简单说下 XDebug 在 Windows 下的配置.
1. 下载XDebug二进制文件: http://www.xdebug.org/download.php
5.2 http://www.xdebug.org/files/php_xdebug-2.1.0-5.2-vc6.dll
5.3 http://www.xdebug.org/files/php_xdebug-2.1.0-5.3-vc6.dll
2. 找到php.ini
3. 如果配置过 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"
4. 加入 XDebug 配置:
zend_extension_ts="path/xdebug/php_xdebug-2.1.0-5.2-vc6.dll"
[Xdebug]
xdebug.profiler_enable=on
xdebug.trace_output_dir="path\xdebug"
xdebug.profiler_output_dir="path\xdebug"
xdebug.remote_enable=on
xdebug.remote_handler=dbgp
xdebug.remote_host=localhost
xdebug.remote_port=9000
说明: 上面 "path" 的地方需要修改为你自己的本地路径.
5. 重启 Apache 或者 IIS.
6. 查看 phpinfo 的输出, 如果看到 XDebug 的选项, 就说明配置成功了.
以下是其他网友的文章
一、安装xdebug模块
1、去www.xdebug.org下载相应版本php的模块文件,保存下载后的文件到php的ext目录,可以自己修改文件的名称,如保存成:php_xdebug.dll
2、修改php.ini,增加如下信息
代码如下:
[Xdebug]
zend_extension_ts="c:/webserver/php5/ext/php_xdebug.dll"
xdebug.auto_trace=on
xdebug.collect_params=on
xdebug.collect_return=on
xdebug.trace_output_dir="c:/webserver/php5/debuginfo"
xdebug.profiler_enable=on
xdebug.profiler_output_dir="c:/webserver/php5/debuginfo"
参数解释:
zend_extension_ts="c:/webserver/php5/ext/php_xdebug.dll"
;加载xdebug模块。这里不能用extension=php_xdebug.dll的方式加载,必须要以zend的方式加载,否则安装上后,phpinfo是显示不出xdebug这个项的。
xdebug.auto_trace=on;
;自动打开“监测函数调用过程”的功模。该功能可以在你指定的目录中将函数调用的监测信息以文件的形式输出。此配置项的默认值为off。
xdebug.collect_params=on;
;打开收集“函数参数”的功能。将函数调用的参数值列入函数过程调用的监测信息中。此配置项的默认值为off。
xdebug.collect_return=on
;打开收集“函数返回值”的功能。将函数的返回值列入函数过程调用的监测信息中。此配置项的默认值为off。
xdebug.trace_output_dir=”c:\Temp\xdebug”
;设定函数调用监测信息的输出文件的路径。
xdebug.profiler_enable=on
;打开效能监测器。
xdebug.profiler_output_dir=”c:\Temp\xdebug”;
;设定效能监测信息输出文件的路径。
还有一些更为具体的参数设定,详见:http://www.xdebug.org/docs-settings.php
3、重启apache
这样,在本地运行php的时候,会在所设定的目录里产生一些调试信息的文件:
函数调用过程监测信息文件的文件名格式:trace.××××××.xt。这个文件可以直接查看,里面包含了函数运行的时间,函数调用的参数值,返回值,所在的文件和位置等信息。内容格式还是相对直观的。
效能监测文件的文件名格式:cachegrind.out.××××××××。
这个文件也可以直接查看,不过信息格式不易被人类所理解,
所以我们需要接下来的一个软件。
二、安装wincachegrind
由于效能监测文件:cachegrind.out.××××××××文件的内容不易被人类所理解,所以我们需要一个工具来读取它。windows下就有一款这样的软件:wincachegrind。
1、到http://sourceforge.net/projects/wincachegrind/下载安装wincachegrind
2、安装运行后,点击Tools->options,设定你的working folder(php.ini里xdebug.profiler_output_dir的值)
这样就可以比较直观的查看效能监测文件的信息了。

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics











Yes, debuggers like XDebug can slow down PHP server performance. This is why the debugger is not placed in a server environment. They are deployed in different environments to avoid unnecessary overhead. Debug messages cannot be displayed in applications that are already in production. When debugging behavior is added to the server, the debugging engine is attached to the PHP process. It starts receiving messages to stop at the breakpoint, but this is not required behavior as it would give a performance hit to other processes, thus stopping the PHP parser. On the other hand, when debuggers are installed, they tend to open ports in the server because they are not intended for use in a production environment. Opening a port in your server is just as bad as opening a door for hackers to snoop through.

Debugging is an inevitable part of PHP development. In order to help developers debug their own code more easily, PHP8.0 introduced a very useful tool in its debugging library: Xdebug. This article will introduce some of the main features of Xdebug and how to use it to simplify the process of PHP debugging. Xdebug is an open source debugging tool that can capture errors in PHP applications and provide detailed error stack trace information, as well as the variables being used. It helps developers detect and troubleshoot code

ThinkPHP6 is a popular PHP framework that uses a variety of technologies to make development more convenient. One such technology is debugging tools such as Xdebug. In this article, we will explore how to use Xdebug for debugging in ThinkPHP6. Install and configure Xdebug Before you start using Xdebug, you first need to install and enable it. In the php.ini file, you can add the following configuration: [xdebug]zend_extension=x

PHP is a programming language widely used in web development. For PHP development tools, choosing a suitable tool can make the developer's work more efficient and convenient. In this article, we will discuss several common PHP development tools, including integrated development environments (IDEs), text editors, and debugging tools. 1. Integrated development environment (IDE) PhpStorm PhpStorm is a powerful PHP development environment developed by JetBrains. It not only supports PH

How to use the PHP extension XDebug for efficient debugging and performance optimization When developing and debugging PHP applications, we often encounter a variety of problems, including incorrect calls, inefficient code, and performance bottlenecks. XDebug is a powerful PHP extension that can help us quickly locate, debug and optimize these problems. This article will introduce how to use XDebug for efficient debugging and performance optimization, and provide some code examples. Install and configure XDebug First, we need to install XDebug

1. Overview of PHP server optimization PHP server optimization refers to improving the performance and stability of the PHP server by adjusting server configuration, optimizing PHP code, and using cache. Common optimization methods include: 1. Optimize PHP code Optimizing PHP code is one of the most direct ways to improve PHP server performance. Methods to optimize PHP code include: using faster algorithms and data structures to avoid unnecessary database queries and recycling caching techniques to improve performance using code analysis tools to find performance bottlenecks 2. Optimize PHP server configuration Optimizing PHP server configuration can also improve performance PHP server performance and stability. Methods to optimize PHP server configuration include: increasing PHP memory limit, adjusting the number of PHP processes, and optimizing

With the rapid development of Internet technology, more and more applications adopt high-concurrency architecture to achieve fast response and high scalability. Swoole, as a popular PHP extension in the field of high concurrency, provides developers with extremely rich functions and good performance. However, when we use Swoole to develop high-concurrency applications, we often encounter various problems, the most troublesome of which is how to debug the program. This article will introduce how to use Xdebug to debug Swoole applications. 1. What is

PHP developers often encounter debugging and testing issues during the development process. To address these issues, we can use some tools to help us better debug and test. Among them, Xdebug and PHPUnit are two essential tools for PHP developers. In this article, we will introduce the basic usage of Xdebug and PHPUnit, including how to use breakpoint debugging and unit testing. Xdebug is a debugger and analyzer for PHP. byX
