php配置
1.首先下载 php_xdebug.dll 文件放至 php安装文件夹的ext下面
2.在php.ini中配置,如:1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24zend_extension="D:/DevelopmentTools/PhpSetup/php-7.1.18/ext/php_xdebug-2.6.0-7.1-vc14-x86_64.dll"
xdebug.remote_enable=on
xdebug.collect_params=3
;xdebug.collect_return=1
xdebug.collect_vars=1
xdebug.collect_assignments=1
xdebug.collect_includes=1
xdebug.trace_format=0
xdebug.auto_trace=0
;xdebug.trace_options=1
;xdebug.profiler_enable =on
;xdebug.profiler_enable_trigger = off
;xdebug.profiler_output_name =cachegrind.out.%t.%p
;xdebug.show_local_vars=1
xdebug.remote_handler = dbgp
xdebug.remote_host= 192.168.10.10
xdebug.remote_port = 9000
xdebug.cli_color=2
xdebug.show_exception_trace=0
xdebug.show_mem_delta=1
xdebug.var_display_max_children=-1
xdebug.var_display_max_data=-1
xdebug.var_display_max_depth=6
xdebug.idekey="vagrant"
上面的配置是我随意配置的,不一定正确,注意 因为我们使用的laravel是在homestead中的,所以地址是 “192.168.10.10”,
别忘了重启服务
phpstorm进行配置
Debug
先打开 File->Settings->Languages & Frameworks -> PHP -> Debug
查看 Xdebug 下面的 Debug port 端口是否和 xdebug.remote_port 一致。
DBGp Proxy
在Languages & Frameworks -> PHP -> Debug -> DBGp Proxy中,
- IDE key :xdebug配置信息中的ide_key
- Host:Homestead.yaml的IP
- Port:大多数情况是80
Servers
在Languages & Frameworks -> PHP -> Servers 中找到配置,点击+添加一个Server
- Name:随意
- Host:homestead.yaml文件的本地地址
Edit Configurations
在菜单中找到 Run -> Edit Configurations, 添加一个 PHP Web Application,
调试
最后在菜单中的右上角的下拉菜单中,选择我们刚才设置的配置,这里是Blog,然后点击旁边的小甲虫即可。