yuchao 发表于 2018-2-11 12:10:03


            笔者的开发环境如下:Windows8.1+Apache+PhpStorm+XDebug+Firefox(XDebug helper 1.4.3插件)。
一、XDebug安装配置
(1)下载XDebug下载地址:http://www.xdebug.org/必须下载跟机器上安装的php匹配的版本才行。具体下载方法如下:将phpinfo网页的源代码拷贝到http://www.xdebug.org/find-binary.php,然后按照指导安装即可。如下图所示:
http://files.jb51.net/file_images/article/201606/2016061308594310.jpg
http://files.jb51.net/file_images/article/201606/2016061308594311.jpg
(2)安装XDebug按照上图下载“php_xdebug-2.3.2-5.4-vc9.dll”,将其复制到d:\php\ext\目录。
(3)配置XDebug打开d:\php\php.ini,在末尾增加如下代码:

zend_extension = d:\php\ext\php_xdebug-2.3.2-5.4-vc9.dll
xdebug.remote_enable =1
xdebug.remote_handler = "dbgp"
xdebug.remote_host = "localhost"
xdebug.remote_mode = "req"
xdebug.remote_port = 9000
重启Apache。
(4)验证安装是否成功检测方法1:在phpinfo网页中,能够检索到XDebug字样,就安装成功了,如下图所示:
http://files.jb51.net/file_images/article/201606/2016061308594312.jpg
检测方法2:
在cmd下输入php -m,能看到XDebug说明配置成功。如下图所示:
http://files.jb51.net/file_images/article/201606/2016061308594313.jpg
二、PHPStorm中XDebug配置在【File】->【Settings】->【Languages & Frameworks】->【PHP】的Setting中:
(1)配置PHP Server找到【Servers】,配置项如下: Name:localhostHost:localhostPort:80Debugger:XDebug如下图所示:
http://files.jb51.net/file_images/article/201606/2016061308594414.jpg
(2)配置PHP Debug找到【Debug】,XDebug中的Debug Port填写9000,其它默认。如下图所示:
http://files.jb51.net/file_images/article/201606/2016061308594415.jpg
三、Fireforx中XDebog helper插件的配置
(1)安装XDebug helper插件如下图所示:
http://files.jb51.net/file_images/article/201606/2016061308594416.jpg
(2)配置XDebug helper插件在上图中,点击【选项】,然后按照如下进行配置:IDE key:PhpStormDomain filter:
localhost如下图所示:
http://files.jb51.net/file_images/article/201606/2016061308594417.jpg
四、使用XDebug调试方法及步骤
(1)在PHPStorm中开启Debug监听点击那个像电话一样的图标即可开启Debug监听,如下图所示:
http://files.jb51.net/file_images/article/201606/2016061308594418.jpg
(2)在Chrome浏览器中开启XDebug helper插件
方法一:在地址栏中,点击那个的虫子,选择Debug,如下图所示:
http://files.jb51.net/file_images/article/201606/2016061308594419.jpg
方法二:使用快捷键:CTRL+SHIFT+X进行配置。
(3)在PHPStorm中设置断点在行号后面空白处单击即可设置断点。
(4)断点调试然后在浏览器中引导到相应的断点处的方法即可自动被断下来,如下图所示:
http://files.jb51.net/file_images/article/201606/2016061308594420.jpg
红色框框中有所有的断点处理方式及快捷键提示。
以上就是本文的全部内容,希望对大家学习PHP调试教程有所帮助。
            
            
您可能感兴趣的文章:[*]解析phpstorm + xdebug 远程断点调试[*]phpstorm配置Xdebug进行调试PHP教程[*]PHP IDE PHPStorm配置支持友好Laravel代码提示方法[*]教你在PHPStorm中配置Xdebug[*]浅谈php+phpStorm+xdebug配置方法[*]使用phpstorm和xdebug实现远程调试的方法[*]图文详解phpstorm配置Xdebug进行调试PHP教程[*]使用PHPStorm+XDebug搭建单步调试环境
页: [1]
查看完整版本: PHPStorm+XDebug进行调试图文教程