Xdebug是一个开放源代码的PHP程序调试器(即一个Debug工具),可以用来跟踪,调试和分析PHP程序的运行状况官方站点:。
下面,是源码安装的具体步骤:
一、解压源码包:
tar xvf xdebug-xxx.taz
cd xdebug-xxx |
二、编译
<yourPhpPath>/bin/phpize
./configure --enable-xdebug --with-php-config=<yourPhpPath>/bin/php-config
make |
三、配置
1、将生产的xdebug.so拷贝到php的lib目录下:
cp modules/xdebug.so /lib/php/extensions/no-debug-non-zts-xxx/ |
2、编辑php.ini,加入以下内容:
[Xdebug]
zend_extension="/lib/php/extensions/no-debug-non-zts-xxx/xdebug.so"
xdebug.auto_trace=on
xdebug.collect_params=on
xdebug.collect_return=on
xdebug.trace_output_name="%H.%s"
xdebug.trace_output_dir="/var/logs/xdebug"
xdebug.profiler_enable=on
xdebug.profiler_output_dir="/var/logs/xdebug"
xdebug.remote_port=7777 |
四、测试
1、编写test.php:
<?php
require_once('inexistence');
?> |
注,’
inexistence‘为不存在的文件
2、测试结果:
( ! ) Warning: require_once(inexistence) []:
failed to open stream: No such file or directory in
/usr/local/apache2/htdocs/test.php on line 2 |
Call Stack |
# | Time | Memory | Function | Location |
1 | 0.0001 | 319628 | {main}( ) | ../test.php:0 |
( ! ) Fatal error: require_once() []:
Failed opening required 'inexistence'
(include_path='.:/usr/local/php5/lib/php') in
/usr/local/apache2/htdocs/test.php on line 2 |
Call Stack |
# | Time | Memory | Function | Location |
1 | 0.0001 | 319628 | {main}( ) | ../test.php:0 |
阅读(1000) | 评论(0) | 转发(0) |