phpstorm 配置 xdebug调试工具

phpstorm 配置 xdebug调试工具

phpstorm 配置 xdebug调试工具

请先看后面的温馨提示!
请先看后面的温馨提示!
请先看后面的温馨提示!

 01)  查看自己需求的xdebug版本,并安装

输出PHP的信息 phpinfo();  或者 php -i >phpinfo.txt ,将全部信息粘贴到   Installation Wizard [ https://xdebug.org/wizard ]  然后点击这里的 Analyse my phpinfo() output 就会提示你需要安装的xdebug版本

 02)   安装chrom xdebug heloer 插件 [ 我自己测试过,安装这个也可以 ]

 03)  配置 PhpStorm  

 

 

 04)  修改 php.ini 文件 如下

注意这里的配置不要写错了,否则最后运行debug没有效果

windows环境配置

[Xdebug]
zend_extension = D:\install\wnmp\php-5.4.45-nts-Win32-VC9-x86\ext\php_xdebug-2.4.1-5.4-vc9-nts.dll     //自己debug位置
xdebug.idekey="PHPSTORM"
xdebug.remote_handler = "dbgp"
xdebug.remote_mode = "req"
xdebug.remote_host=127.0.0.1
xdebug.remote_enable=on
xdebug.remote_port = 9001   //这是设置端口 可以改 只要下面这是phpstorm 一致就可以 
xdebug.remote_autostart = no

vagrant 中centos 虚拟机 中配置 /etc/php.d/15-xdebug.ini 文件

zend_extension=xdebug.so
xdebug.idekey="PHPSTORM"
xdebug.remote_connect_back = 1   //这项不要丢了
xdebug.remote_handler = "dbgp"
xdebug.remote_mode = "req"
xdebug.remote_host=127.0.0.1
xdebug.remote_enable=on
xdebug.remote_port = 9001
xdebug.remote_autostart = no
 

 

 05)  运行debug

温馨提示:配置前请阅读以下内容

断点调试过程中会出现debug一直在 index.php 第一行不往下走的情况,在菜单栏run->Break at first line in PHP scripts勾上;可以解决这个问题,如图

扩展:

扩展2:  phpstorm版本差异

左侧绿色三角形 : Resume Program,表示將继续执行,直到下一个中断点停止。

左侧红色方形 : Stop,表示中断当前程序调试。

上方第一个图形示 : Step Over,跳过当前函数。

上方第二个图形示 : Step Into,进入当前函数內部的程序(相当于观察程序一步一步执行)。

上方第三个图形示 : Force Step Into,強制进入当前函数內部的程序。

上方第四个图形示 : Step Out,跳出当前函数內部的程式。

上方第五个图形示 : Run to Cursor,定位到当前光标。

Variables :可以观察到所有全局变量、当前局部变量的数值

Watches : 可以新增变量,观察变量随着程序执行的变化。

其他参考资料:

phpstorm 配置 xdebug调试工具

http://www.jianshu.com/p/8fb9ad0719c2

https://stackoverflow.com/questions/11563280/php-remote-debugging-xdebug-cant-connect-to-jetbrains-php-storm-client

xdebug 官方配置参数说明  https://xdebug.org/docs/all_settings 

附上phpstorm 官方配置说明:

phpstorm2017:  

https://blog.jetbrains.com/phpstorm/?s=configure+php+debugging

https://blog.jetbrains.com/phpstorm/2016/10/webinar-recording-step-into-debugging-with-phpstorm/

原文地址:https://www.cnblogs.com/dafei4/p/12939223.html