Jason's blog
We have so many needs in our life, but at the end of the day, all we need is...to be needed.

转自zendchina,可查看原文,之所以转载,是因为网上的各种资料都不太全,本文很全面。本人在该问题上也遇到很多困难,终于从本文获得启发。希望遇到同样问题的朋友们能尽快解决该问题。同时声明:网传的windows下不能使用zend调试是错的,很难用也是错的,只是不得法而已,不要以讹传讹。我自己尝试的辛苦,希望朋友们能少走些弯路。

下载xdebug,看清版本,很重要,这里使用php_xdebug-2.0.5-5.2.dll,符件中有;

必须以Zend方式加载,见php.ini中配置。配置D:\EasyPHP\PHP\php.ini,先把optimization注释掉使用";"

如下:

;[Zend]
;zend_optimizer.optimization_level=1023
;zend_extension_ts="../Zend/ZendExtensionManager.dll"
;zend_extension_manager.optimizer_ts="../Zend/Optimizer-3.3.0"
;zend_extension_ts="D:/EasyPHP/PHP/ext/ZendDebugger.dll"
;zend_debugger.allow_hosts=127.0.0.1/32
;zend_debugger.expose_remotely=always
;extension=php_xdebug-2.0.5-5.2.dll
[Xdebug]
zend_extension_ts=D:/EasyPHP/PHP/ext/php_xdebug-2.0.5-5.2.dll
xdebug.profiler_enable=on
xdebug.trace_output_dir="D:/EasyPHP/xdebug"
xdebug.profiler_output_dir="D:/EasyPHP/xdebug"
xdebug.remote_enable=On
xdebug.remote_host="localhost"
xdebug.remote_port=19000
xdebug.remote_handler="dbgp"

请修改端口为19000防止端口被占用,修改web browse,如下图

1_201105271110431yKQ8[1]
02f3aa69-a72c-3f6f-9961-df2175130fd1[1]

不要使用FF会报下面的错误:

waiting for XDebug seession...就不动了,选择IE正常
3b626781-cc30-3c93-a00a-37971669368f[1]

1_201105271110432Amea[1]

然后再按下面配置:

另外:

Zend Studio for Eclipse开启XDebug的方法:

- 6.0.0\plugins\com.zend.php_6.0.0.v20080107\plugin_customization.ini

将这行org.eclipse.ui.workbench/UIActivities.com.zend.php.debug.ui.XDebugActivity=false
改成true,保存后,重新启动Zend Studio 7,php debug里面就可以选择Xdebug进行调试了。

1_201105271110433rX2W[1]
cfcf2c2e-e88f-3587-aa2a-8fd36d92d2cf[1]

1_201105271110434SBhM[1]
404fa9ad-6b50-300e-8397-8aed9bfb24df[1]

1_201105271110435A1DJ[1]

选择要debugger的web页面

1_201105271110436fT64[1]1_201105271110436fT64[1][1]1_201105271110436fT64[1][2]1_201105271110437mM47[1]1_201105271110437mM47[1][1]1_201105271110437mM47[1][2]1_2011052711104380406[1]1_2011052711104380406[1][1]1_2011052711104380406[1][2]1_2011052711104397eht[1]

另外WinCacheGrind的使用参考:http://hi.baidu.com/lostdays/blog/item/c2ef51a920c62ff81f17a2f4.html

我的phpinfo信息如下,方便出现问题对比版本:

PHP Version 5.2.5

System
Windows NT WV 5.1 build 2600

Build Date
Nov 8 2007 23:18:08

Configure Command
cscript /nologo configure.js "--enable-snapshot-build" "--with-gd=shared"

Server API
Apache 2.0 Handler

Virtual Directory Support
enabled

Configuration File (php.ini) Path
C:\WINDOWS

Loaded Configuration File
D:\EasyPHP\PHP\php.ini

PHP API
20041225

PHP Extension
20060613

Zend Extension
220060519

Debug Build
no

Thread Safety
enabled

Zend Memory Manager
enabled

IPv6 Support
enabled

Registered PHP Streams
php, file, data, http, ftp, compress.zlib, compress.bzip2, zip

Registered Stream Socket Transports
tcp, udp

Registered Stream Filters
convert.iconv.*, string.rot13, string.toupper, string.tolower, string.strip_tags, convert.*, consumed, zlib.*, bzip2.*

posted on 2011-12-28 12:55  Jason .Z  阅读(494)  评论(0编辑  收藏  举报