美文网首页
在PhpStorm中使用XDebug进行断点调试

在PhpStorm中使用XDebug进行断点调试

作者: 大鹏的鹏 | 来源:发表于2019-04-18 14:12 被阅读0次

一.安装xdebug.

1. 打开xdebug的官网.
2. 将phpinfo信息copy到分析框里面进行分析.


注意:下载和自己开发工具版本差不多的版本,建议下低一点的版本(本人在此坑了很久)

3. 打开php.ini,在末尾增加如下代码.
[Xdebug]
zend_extension =D:\phpstudy\PHPTutorial\php\php-7.2.1-nts\ext\php_xdebug-2.6.1-7.2-vc15-nts.dll
;开启远程调试
xdebug.remote_enable=1    
xdebug.remote_handler =dbgp
xdebug.remote_mode =req       
xdebug.idekey="PHPSTROM"
xdebug.remote_log="D:/xdebug.log"
xdebug.collect_return=Off
;端口号,这里是将最好将端口改了一下,避免端口冲突
xdebug.remote_port=9020  
4. 重启Apache,进入到phpinfo里面进行查找,看有没有xdebug。

二. PhpStome设置

1. 先将php的版本设置成和xdebug一致.
2. 进入File>Settings>PHP>Servers,这里要填写服务器端的相关信息,name填localhost,host填localhost,port填80,debugger选XDebug。
3. 进入File>Settings>PHP>Debug,看到XDebug选项卡,port填9000,其他默认。
4. 进入File>Settings>PHP>Debug>DBGp Proxy,IDE key 填 PHPSTORM,host 填localhost,port填9000,点OK退出设置
5. 设置调试页面.

相关文章

网友评论

      本文标题:在PhpStorm中使用XDebug进行断点调试

      本文链接:https://www.haomeiwen.com/subject/svyzwqtx.html