Heim  >  Artikel  >  php教程  >  使用phpstorm和xdebug实现远程调试的方法,phpstormxdebug

使用phpstorm和xdebug实现远程调试的方法,phpstormxdebug

WBOY
WBOYOriginal
2016-06-13 08:48:341121Durchsuche

使用phpstorm和xdebug实现远程调试的方法,phpstormxdebug

vs的断点调试功能很强大有木有,能查看所有变量有木有。php调试很麻烦有木有,echo,var_dump写得你想吐了有木有。想体验一下ide调试的快感吗?那就来使用xdebug吧。

1.原理:xdebug是一款php调试插件,支持远程调试,就是在php文件运行的时候,能通过tcp协议,来发送调试信息到远程端口,ide在收到调试信息的时候,可以向xdebug发送单步运行,中止运行,运行等命令。这样就实现了vs那样强大的调试功能。

2.需要的东东:一款支持xdebug远程调试的ide,这里使用phpstorm,是一个灰常强大的phpide。另外需要一款你的php对应版本的xdebug。

3.步骤:先下载xdebug,请在官网下载你的php版本对应的xdebug

如果你不知道你的版本呢,请echo phpinfo();哈哈,然后把整个页面复制到http://xdebug.org/wizard.php 这个页面的框里,然后他会自动分析你的php版本,然后告诉你放在哪个文件夹,我们放在php的拓展文件夹就好了,我是D:\xampp\php\ext

然后配置php.ini,在最后加上这个:

[xdebug]
zend_extension = D:\xampp\php\ext\php_xdebug-2.2.0-5.3-vc9.dll
xdebug.remote_enable=1
xdebug.remote_host=127.0.0.1
xdebug.remote_port=9000
xdebug.idekey=phpstorm4
xdebug.remote_autostart=1

解释下,第一行是加载xdebug,romote_enable是开启远程调试,下面是远程调试的参数,ip,端口,识别字符串,自动远程调试。

然后重启apache,xdebug就加载成功了,为神马网站会慢很多呢,因为你开启了自动远程调试,每一次访问都会连接一下定义的ip和端口。哈哈。这个看自己取舍吧。

然后就是配置ide了,

选择editconfig,然后按这样配置:

在php remote debug里面配置好服务器 127.0.0.1 80 xdebug,然后设置好识别字符串。这里是我们已经定义了的phpstorm4,然后保存。这样就配置好了。

4.使用:现在我们就可以开始调试了。

点击者按钮,开始监听远程调试,当变成绿色表示监听成功。下面我们设置一个断点。

看到木有,有木有有木有很强大,可以一步一步执行哦,F7单步进入函数,F8是单步跳过函数。有不明白的留言哦。

您可能感兴趣的文章:

  • 解析phpstorm + xdebug 远程断点调试
  • phpstorm配置Xdebug进行调试PHP教程
  • 教你在PHPStorm中配置Xdebug
  • 浅谈php+phpStorm+xdebug配置方法
Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn