PHP代碼審計(一) 安裝xdebug
VSole2021-07-24 14:14:37
xdebug介紹
從其他語言使用者到初次使用phpstorm或者其他ide的小伙伴可能會發現phpstorm默認的調試功能并不 能直接調試php腳本。php不像JAVA,打開一個Eclipse就可以開搞,Php的Debug都要幾個插件來配合工作
xdebug是一個開源的php調試器,以php模塊的形式加載并被使用。可以用來跟蹤,調試和分析PHP程序的運行狀況
xdebug官網:https://xdebug.org/
安裝xdebug
- 將phpinfo內容復制到https://xdebug.org/wizard中查找適合的xdebug版本


- 根據提示下載dll文件放到指定位置,修改php.ini添加如下內容,其中zendzendextension,xdebug.traceoutputdir,xdebug.profileroutputdir根據自己要求修改
[ Xdebug ] zend_extension = C : \php\ext\php_xdebug - 3.0 . 4 - 7.4 - vc15 - nts - x86_64 . dll xdebug . profiler_enable = On xdebug . auto_trace = on xdebug . collect_params = On xdebug . collect_return = On xdebug . trace_output_dir = "C:/debug" xdebug . profiler_output_dir = "C:/debug" xdebug . profiler_output_name = "cachegrind.out.%p" xdebug . remote_enable = On xdebug . remote_port = 9001 xdebug . remote_handler = dbgp xdebug . remote_host = localhost xdebug . idekey = "PHPSTORM"
再看一下phpinfo出現這個即安裝成功

3.配置PHPstorm,修改調試端口為php.ini配置的xdebug.remote_port=9001

配置DBGp代理IDEkey為剛剛php.ini設置的xdebug.idekey,主機為本機ip地址

點擊開始監聽然后點擊開始調試發現程序成功在斷點處中斷

VSole
網絡安全專家