您的位置:首页 > 编程语言 > PHP开发

phpStorm如何进行xDebug断点调试

2017-11-07 12:01 316 查看
phpStorm如何进行xDebug断点调试

       程序开发中经常会通过deBug的方式排除程序故障、监控运行时的数据。

       php开发中,需要安装deBug插件,以满足deBug调试的需要。

  一.PHP安装xdebug扩展

       1.首页到php的 xdeBug官网下载deBug插件

       https://xdebug.org/download.php
       下载xdebug插件后php_xdebug-2.5.5-5.5-vc11-nts-x86_64.dll,将文件拷贝到php安装目录的ext文件夹下

       拷贝路径为:D:\phpStudy\php\php-5.4.45\ext

       2.在php.ini文件最后添加xdebug配置路径

          PHP版本 : 5.6.2

          xdebug版本:php_xdebug-2.5.5-5.5-vc11-nts-x86_64.dll

zend_extension = D:\phpStudy\php\php-5.4.45\ext\php_xdebug-2.5.5-5.5-vc11-nts-x86_64.dll
xdebug.remote_enable =1
xdebug.remote_handler = dbgp
xdebug.remote_host = localhost
xdebug.remote_mode = req
xdebug.remote_port = 9000
xdebug.idekey=PHPSTORM


         3.用PHPstudy:其他选项菜单/PHP扩展设置/PHP扩展/XDEBUG打上对钩

 二.PHPSTORM设置

1.首先检查phpstorm的xdebug配置

          这里的debug port要和php.ini里面的xdebug.remote_port相一致!默认是9000,如果9000端口被占用的话,可以改成其他端口。



phpstorm配置
客户端调试,打开phpStorm,进入File>Settings>PHP>Servers,这里要填写服务器端的相关信息,name填localhost,host填localhost,port填80,debugger选XDebug
进入File>Settings>PHP>Debug,看到XDebug选项卡,port填9000,其他默认
进入File>Settings>PHP>Debug>DBGp Proxy,IDE key 填 phpStorm,host 填localhost,port 填80
点OK退出设置。





 2. 设置debug.

     创建PHP应用并设置debug



3.开始调试

        开启点开电话图标监听

打好第一个断点,shift + F9就可以了

打好第一个断点,选中配置的debug,  按旁边的臭虫 按钮



    
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: