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