1. Vagrant
我使用的是宝塔面板,首先安装xdebug,并且打开php对应版本的配置文件:
zend_extension=xdebug.so
xdebug.idekey = "PHPSTORM" #需要和ide根据保持抑制
xdebug.default_enable = 1
xdebug.remote_connect_back = 1
xdebug.remote_port = 9001 #需要和ide根据保持抑制
xdebug.remote_enable = 1
xdebug.remote_autostart = 0
xdebug.remote_handler="dbgp"
xdebug.auto_trace = 1
xdebug.remote_log=/tmp/xdebug.log
注意,这里的xdebug.remote_autostart 需要设置成0,否则phpstorm无法自动监听端口。
2.PHPSTORM配置
首先配置remote php:
设置Debug的端口号:
设置DBGP proxy:
配置server:
注意勾选use path mapping,并且右侧选择在vagrant里的对应的项目的路径(需要自己手动输入,不人性化)
配置php web page configuration:
开启监听按钮: