參考
如下配置均在windows環境下。
一、下載xdebug
使用phpinfo()查看當前php的版本信息:
到xdebug下載頁面下載對應的xdebug版本:
將解壓出的php_xdebug-2.1.2-5.3-vc6.dll文件重命名爲php_xdebug.dll後放入php下的ext目錄裏。
二、在php.ini文件中加入如下內容: php
zend_extension="D:/wamp/php/ext/php_xdebug.dll" [Xdebug] xdebug.profiler_enable=on xdebug.trace_output_dir="D:\wamp\xdebug" xdebug.profiler_output_dir="D:\wamp\xdebug" xdebug.max_nesting_level = 10000 ;開啓自動跟蹤 xdebug.auto_trace=On ;開啓異常跟蹤 xdebug.show_exception_trace=On xdebug.remote_enable=On xdebug.remote_host=127.0.0.1 xdebug.remote_port=9000 xdebug.remote_handler=dbgp
"D:\wamp\xdebug"爲放置xdebug輸出的數據文件的目錄。而後重啓服務器。再查看phpinfo()輸出,是否有xdebug擴展。
三、打開zend studio。Windows->Preferences->PHP->Debug設置以下:
四、斷點調試
在程序裏設置斷點,點擊工具欄中小蟲子旁邊的下拉選項,選擇Debug As->PHP Web Application,進入Debug透視圖:
五、對於xdebug生成的數據文件,還能夠使用WinCacheGrind軟件進行性能分析
windows