First recommended three developers of PHP plug-in vscode
PHPDebug for debugging php, here mainly refers to the break point, F5 and other operations. xdebug is health tracking, analysis and debugging PHP programs
PHP IntelliSense is a function of intelligent prompts php
php cs fixer can be formatted code to support PSR specification
Download XDebug https://xdebug.org/download.php
windows on
Find pnp.ini
[XDebug]
zend_extension=php_xdebug.dll
xdebug.remote_enable = 1
xdebug.remote_autostart = 1
xdebug.remote_handler = dbgp
xdebug.remote_host= 127.0.0.1
xdebug.remote_port = 9001
vscode in
setting.json configured to perform the path php
"php.validate.executablePath": "D:/phpstudy_pro/Extensions/php/php7.3.4nts/php.exe"
launch.json port is the port PORT xdebug configuration settings xdebug
"configurations": [
{
"name": "Listen for XDebug",
"type": "php",
"request": "launch",
"port": 9001
},
{
"name": "Launch currently open script",
"type": "php",
"request": "launch",
"program": "${file}",
"cwd": "${fileDirname}",
"port": 9001
}
]
This can be used vscode add breakpoints in debugging mode on windows php code
On linux
Vscode use of Remote-SSH plug-in remotely open files on linux, and then set the port xdebug installation in linux php, you can use vscode remote debugging break point the way php code
First install Remote-SSH plug-in on vscode
Configuration config
192.168.xx.xx the Host
the HostName 192.168.xx.xx
the User xuebing
Port 10088
# Free adhesion can configure the following two log
#PreferredAuthentications the publickey
#IdentityFile ~ / .ssh / id_rsa
Free density log on, needs to send the local to the remote server id_rsa.pub ssh-copy-id -i ~ / .ssh / id_rsa.pub <romte_ip>
Xdebug installed on linux, this need to download the compiled
wget https://xdebug.org/files/xdebug-2.5.5.tgz tar -zxvf xdebug-2.5.5.tgz cd xdebug-2.5.5 phpize ./configure --with-php-config=/usr/local/php7/bin/php-config make make install
Then configure php.ini
zend_extension="xdebug.so"
xdebug.remote_port= 8888
xdebug.remote_enable = 1
xdebug.remote_autostart = 1
xdebug.remote_handler = dbgp
xdebug.remote_host= 192.168.x.x
xdebug.remote_port = 8888
remote_host is your linux server ip
final configuration vscoded of launch.json with Windows
port into a port to listen on linux xdebug current