vscode使用php調試


1:首先查看是否安裝xdebug擴展

  打開終端  

➜ ~ php -v
PHP 5.6.24 (cli) (built: Jul 21 2016 14:27:54)
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies
with Xdebug v2.4.1, Copyright (c) 2002-2016, by Derick Rethans
with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2016, by Zend Technologies

  如果沒有安裝怎pecl install xdebug安裝擴展

  在php.ini文件中添加zend_extension=/usr/lib64/php/modules/xdebug.so

2 配置xdebug

  vim /etc/php.ini 添加xdebug配置

  xdebug.remote_port = 9000 端口如果修改則需在vscode中的配置文件中修改port選項

  xdebug.auto_trace=1 默認打開xdebug

  xdebug.remote_host = "localhost"
   xdebug.remote_mode = "req"

3配置vs code

  安裝php debug擴展

  設置可用的php路徑

  "php.validate.executablePath": "/bin/php"

4在chrome中安裝xdebug helper 擴展程序

  

 

5開啟debug

  

 

詳解https://xdebug.org/docs/all

  


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM