Xdebug
今天试着装了下Xdebug工具,感觉这个debug工具挺强的。没怎么玩熟呢,先记录下安装步骤。
首先去官网http://xdebug.org/download.php下载最新版 Xdebug 2.1.0
Xdebug 2.1.0
Release date: 2010-06-29
- source
- Windows binaries: 5.2 VC6 Non-thread-safe (32 bit), 5.2 VC6 (32 bit), 5.3 VC6 Non-thread-safe (32 bit), 5.3 VC6 (32 bit), 5.3 VC9 Non-thread-safe (64 bit), 5.3 VC9 Non-thread-safe (32 bit), 5.3 VC9 (64 bit), 5.3 VC9 (32 bit)
我下的linux下安装的source版。
linux下安装其实很简单,下载完解压缩后,下面有个README的文件,打开看下,里面其实就是教你怎么安装的。我把内容贴上来,大家一看就明白了。
XDEBUG
------
You need to compile Xdebug separately from the rest of PHP. Note, however,
that you need access to the scripts "phpize" and "php-config". If your
system does not have "phpize" and "php-config", you will need to compile
and install PHP from a source tarball first, as these script are
by-products of the PHP compilation and installation processes. It is
important that the source version matches the installed version as there
are slight, but important, differences between PHP versions.
Once you have access to "phpize" and "php-config", do the following:
1. Unpack the tarball: tar -xzf xdebug-2.1.x.tgz. Note that you do
not need to unpack the tarball inside the PHP source code tree.
Xdebug is compiled separately, all by itself, as stated above.
第一步:解压缩 tar -xzf xdebug-2.1.x.tgz
2. cd xdebug-2.1.x
第二步:进入刚解压好的目录 cd xdebug-2.1.x
3. Run phpize: phpize
(or /path/to/phpize if phpize is not in your path).
第三步:运行phpize命令(如果该命令不在系统的path内,使用你全路径)
4. ./configure --enable-xdebug (or: ../configure --enable-xdebug
--with-php-config=/path/to/php-config if php-config is not in your
path)
第四步:执行./configure --enable-xdebug命令
5. Run: make
第五步:执行make命令
6. cp modules/xdebug.so /to/wherever/you/want/it
第六步:把编译好的xdebug.so文件拷贝到你想要的地方
7. add the following line to php.ini:
zend_extension="/wherever/you/put/it/xdebug.so"
配置php.ini文件,其实就是添加扩展。
这里需要说明下,如果仅添加php的扩展,而不开始trace等其他参数的话,默认是不打印调试信息的。
以下配置供参考:
[xdebug]
zend_extension="/wherever/you/put/it/xdebug.so"
xdebug.auto_trace=On
xdebug.collect_params=On
xdebug.collect_return=On
;xdebug.trace_output_dir="/your trace output dir"
;if you not configure the dir, default dir is /tmp. And the debug file is like trace.xxxx.xt
;xdebug.profiler_enable=On
;xdebug.profiler_output_dir="/your profiler output dir"
;if you not configure the dir, default dir is /tmp
8. Restart your webserver.
9. Write a PHP page that calls "phpinfo();" Load it in a browser and
look for the info on the xdebug module. If you see it, you have been
successful!
查看phpinfo内xdebug扩展添加成功没。
ok, that's all.
添加新评论