使用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配置方法

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Safe Exam Browser
Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

VSCode Windows 64-bit Download
A free and powerful IDE editor launched by Microsoft

MantisBT
Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.

SecLists
SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.
