最近在看php开发,遇到断点调试问题。如果是xcode只需要运行就可以断掉调试,但是如果是使用phpstrom,直接断点是不好使的,必须基于Xdebug才能进行调试。在配置集成开发环境的时候遇到一些问题,在这里把配置过程记录一下。
1.打开xdebug设置
mamp默认是自带xdebug插件的,我们需要做的是开启xdebug功能。

2.查看phpinfo中的IDE Key
和xdebug.remote_port
记录下Xdebug栏中的IDE Key

记录下Xdebug栏中的
remote_port

如果你的IDE key
显示的为null,你可以在当前使用版本的php.ini上添加
xdebug.idekey="PHPSTORM"
如图

然后重启你的mamp
3.配置PhpStorm
1).配置当前使用的php版本

2).在Debug port中使用上面记录下的Xdebug栏中的remote_port

3).填写信息监控网址

IDE Key:就是上面记录下的Xdebug栏中的IDE Key
Host:就是当前监听的网址(如果需要更改监听的网址,只需要更改这里即可)
Port:就是Debug port中的端口
4).配置Servers

填写监听的域名和端口号,端口号和Apache的端口号保持一致
5).编辑配置文件


1:创建一个PHP Web Application

2:开始监听
6).在火狐浏览器安装theeasiestxdebug
插件

并且修改插件的首选项中IDE key

7).开始断点调试
在phpstorm中,在你想要断点的地方添加断点

然后将url输入到浏览器

回车,然后就可以看到debug的信息了

网友评论