phpstorm配置远程xdebug

服务器端

编译安装xdebug模块的方法这里就不讲了,还不会的可以自行百度。
配置

zend_extension="/YOURPATH/extensions/no-debug-zts-20151012/xdebug.so"
xdebug.profiler_output_dir="/YOURPATH/logs/xdebug/profile"
xdebug.trace_output_dir="/YOURPATH/logs/xdebug/trace"
xdebug.profiler_enable=On
xdebug.profiler_enable_trigger=1
xdebug.default_enable=On
xdebug.show_exception_trace=Off
xdebug.show_local_vars=1
xdebug.max_nesting_level=50
xdebug.var_display_max_depth=6
xdebug.dump_once=On
xdebug.dump_globals=On
xdebug.dump_undefined=On
xdebug.dump.REQUEST=*
xdebug.dump.SERVER=REQUEST_METHOD,REQUEST_URI,HTTP_USER_AGENT
xdebug.remote_enable=On
xdebug.remote_handler=dbgp
xdebug.remote_host=192.168.56.1
xdebug.remote_connect_back=1
xdebug.remote_port=9001
xdebug.idekey=PHPSTORM

其中
1. remote_host是服务器端观察到的客户端的ip
2. remote_port是侦听的端口,需要在客户端配置
3. idekey是连接标识,需要在客户端配置

客户端配置

配置debug代理信息

在偏好设置中,查找debug,按如下配置:
这里写图片描述

注意其中的Debug port,必须配置为与服务端remote_port相同。

还是在偏好设置中,查找dbgp proxy,作如下配置

这里写图片描述
这里的host配置为远程服务器的ip,ide key需要与服务端配置一致,端口写作web服务的访问端口,默认是80

在偏好设置中,查找Servers,找到Languages & Frameworks->PHP->Servers,新建一个server,起一个名字(随意起);Host写你在本地访问远程web服务的host,如abc.com;Port是web服务的port,通常是80;Debugger选择Xdebug;然后下面的“Use path mappings”必须要勾选,然后添加一条map,将本地项目所在目录映射到远程服务器上的目录。这个还需要配置sftp文件同步,两者是相对应的,如何配置sftp这里就不写了。

添加debug配置

上述操作完成后,就可以添加debug配置了,在phpstorm右上方运行配置那里,新加一个php web application,就可以针对指定的url侦听xdebug断点了。当然要添加php script debug也是可以的,按提示操作即可。

猜你喜欢

转载自blog.csdn.net/terminatorsong/article/details/62889847
今日推荐