iloveflag-blog

nginx-php-vscode-xdebug

字数统计: 98阅读时长: 1 min
2020/06/14 Share

edit nginx conf to run php


copy phpinfo(); to https://xdebug.org/wizard and follow the command

add this code to /etc/php/7.2/fpm/php.ini

1
2
3
4
5
6
7
8
zend_extension = /usr/lib/php/20170718/xdebug.so
xdebug.remote_autostart = 1
xdebug.remote_enable = 1
xdebug.remote_handler = dbgp
xdebug.remote_host = 127.0.0.1
xdebug.remote_log = /tmp/xdebug_remote.log
xdebug.remote_mode = req
xdebug.remote_port = 9000 #this can be modified

install php debug in vscode and default lauch.json is just ok!


make sure the listen port is same(9000 there!)

debug it in firefox!

CATALOG
  1. 1. edit nginx conf to run php
  2. 2. copy phpinfo(); to https://xdebug.org/wizard and follow the command
  3. 3. add this code to /etc/php/7.2/fpm/php.ini
  4. 4. install php debug in vscode and default lauch.json is just ok!
  5. 5. debug it in firefox!