zhuan:https://blog.csdn.net/gd_9988/article/details/106248573

tips:不确定xdebug版本的,把phpinfo()的网页源代码全部复制到wizard.php页面的文本框中,点击Analyse my phpinfo() output 跳转到下载配置页面,按页面提示流程安装即可。

二、安装xdebug

1、点击匹配地址,把复制的phpinfo信息粘贴到文本框。

2、按照页面的安装流程安装xdebug。

3、配置php.ini

[xdebug]
zend_extension = /usr/lib/php/extensions/no-debug-non-zts-20121212/xdebug.so  //这是配置xdebug
xdebug.remote_enable = On  //是否运行远程终端,必须开启
xdebug.remote_handler = "dbgp"
xdebug.remote_host = "localhost"
xdebug.remote_port = 9000  //这个端口号要和phpstorm中的保持一致,示例的端口是9001
xdebug.idekey = PHPSTROM  //调试器关键字

tips:xdebug官网上的配置,只保证配置好xdebug,但不能与phpstorm进行配置,正确的配置方法,还要在php.ini的xdebug模块下添加以下代码。

安装xdebug图例:

 
mac下的phpstorm增加xdebug调试
image
 
mac下的phpstorm增加xdebug调试
image

查看phpinfo( ),有没有开启xdebug。

 
mac下的phpstorm增加xdebug调试
image

三、配置phpstorm以支持xdebug

1、点击左上角phpstorm,选择preferences。

 
mac下的phpstorm增加xdebug调试
image

2、配置php下的Debug

 
mac下的phpstorm增加xdebug调试
image

3、配置Debug下的DBGp proxy

 
mac下的phpstorm增加xdebug调试
image

4、配置servers

 
mac下的phpstorm增加xdebug调试
image

5、点击phpstorm右上角的三角形,选择Edit Configurations,配置服务器信息,添加项目调试开发地址,保存完后phpstorm配置完成。

(1)

 
mac下的phpstorm增加xdebug调试
image

(2)

 
mac下的phpstorm增加xdebug调试
image

(3)

 
mac下的phpstorm增加xdebug调试
image

四、chrome安装xdebug

xdebug for chrome (chrome插件商店,需要梯子)

 
mac下的phpstorm增加xdebug调试
image

配置xdebug 插件(可省略)

 
mac下的phpstorm增加xdebug调试
image

五、断点程序调试

1、在需要调试的代码左侧空白左键点击打上红色圆形按钮,再点击红色按钮取消。

 
mac下的phpstorm增加xdebug调试
image

 

 

2、点击phpstorm右上角甲壳虫按钮
 
mac下的phpstorm增加xdebug调试
image

 

 

打开浏览器,要保证旁边的电话图标是绿色的
 
mac下的phpstorm增加xdebug调试
image

 

 

,红色的
 
mac下的phpstorm增加xdebug调试
image

表示关闭调试,程序运行到该断点时(不包括当前断点行),会停留并从浏览器页面返回到phpstorm,此时浏览器会一直处于加载等待中。

3、浏览器跳转打开phpstorm后,页面上和debugger框会有数据信息显示,如下图。

代码页面:

 
mac下的phpstorm增加xdebug调试
image

debugger框:

 
mac下的phpstorm增加xdebug调试
image

六、调试过程中警告提示

 
mac下的phpstorm增加xdebug调试
image

上图弹窗是程序正在调试时,试图关闭phpstorm时的提示,这个时候可以完成调试再关闭,或者结束调试再关闭。

 
mac下的phpstorm增加xdebug调试
image

至此,mac下的phpstorm添加xdebug就结束了,祝大家敲一手风骚无bug的好代码!!!

[XDebug]
zend_extension=C:/php/ext/php_xdebug-2.1.0-5.3-vc9.dll
xdebug.default_enable=on ;显示默认的错误信息
xdebug.collect_params = 1    ;打开收集“函数参数”的功能。将函数调用的参数值列入函数过程调用的监测信息中。此配置项的默认值为off。
xdebug.profiler_enable=on    ;打开效能监测器
xdebug.auto_trace=on        ;自动打开“监测函数调用过程”的功模。该功能可以在你指定的目录中将函数调用的监测信息以文件的形式输出。此配置项的默认值为off。
xdebug.trace_output_dir="C:/php/xdebug/xdebug.trace_output_dir"    ;设定函数调用监测信息的输出文件的路径
xdebug.profiler_output_dir="C:/php/xdebug/xdebug.profiler_output_dir"    ;设定效能监测信息输出文件的路径
xdebug.remote_enable=on            ;远程调试打开
xdebug.remote_handler=dbgp        ;远程头请求方式
xdebug.remote_host=localhost    ;远程地址
xdebug.remote_port=9000            ;远程端口号
 
 
12人点赞
 
 



作者:手表大大
链接:https://www.jianshu.com/p/c99867e8e49c
来源:简书
著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。

相关文章: