如果具备了 PHP 实用工具 phpize 和 php-config,而且具有对系统的 php.ini 配置文件的访问权,那么安装和设置 Xdebug 只需几分钟的时间。
下面给出的指导说明针对 Linux?,不过在 Mac OS X 上的安装步骤实际上与此类似。(您可以从 Xdebug Web 站点找到针对 Microsoft? Windows? 的 Xdebug 预编译版本。)
Xdebug 的最新版本为 V2.0.0RC3(最终版本 V2.0.0 在您阅读此文时也许已经可用)。下载并解包 tarball,然后切换到源代码的子目录。确保 phpize 和 php-config 位于 shell 的 PATH,准备使用 phpize 进行构建。
清单 1. 设置 Xdebug
$ wget http://www.xdebug.org/files/xdebug-2.0.0RC3.tgz $ tar xzf xdebug-2.0.0RC3.tgz $ cd xdebug-2.0.0RC3/xdebug-2.0.0RC3 $ phpize Configuring for: PHP Api Version: 20020918 Zend Module Api No: 20020429 Zend Extension Api No: 20050606
清单 2. 构建 Xdebug
$ ./configure checking build system type... i686-apple-darwin8.8.1 checking host system type... i686-apple-darwin8.8.1 checking for egrep... grep -E ... $ make ... Build complete. (It is safe to ignore warnings about tempnam and tmpnam).
$ sudo make install Installing shared extensions: /usr/lib/php/extensions/no-debug-non-zts-20020429/
更多内容请看PCdog.com--PHP应用篇专题
