码上敲享录 > PHP开发经验分享 > phpstorm如何打断点调试php代码

phpstorm如何打断点调试php代码

上一章章节目录下一章 2020-01-05已有1838人阅读 评论(0)

phpstorm如何打断点调试php代码


解决方法:

1.修改php.ini文件,我安装php的目录是E:\xampp\php:

[XDebug]

zend_extension = "E:\xampp\php\ext\php_xdebug.dll"

xdebug.profiler_append = 0

xdebug.profiler_enable = 1

xdebug.profiler_enable_trigger = 0

xdebug.profiler_output_dir = "E:\xampp\tmp"

xdebug.profiler_output_name = "cachegrind.out.%t-%s"

xdebug.remote_enable = 1

xdebug.remote_handler = "dbgp"

xdebug.remote_host = "127.0.0.1"

xdebug.trace_output_dir = "E:\xampp\tmp"

xdebug.idekey= PHPSTROM

xdebug.remote_port = 9000

cmd命令行窗口执行:E:\xampp\php\php.exe -m


2.重启apache服务,cmd命令行窗口执行:E:\xampp\php\php.exe -m

如果显示的列表中有xdebug说明开启xdebug服务成功


3.在phpstorm中配置你本地安装的php

File-->settings-->Languages&Frameworks-->PHP-->点击右边的CLI Interpreter后面有三个点的按钮-->弹出“CLI Interpreters”,点击左上角的“+”,选择Local Path to Interpreter-->

在右边的PHP executable中选择你本地安装的php.exe,我的是E:\xampp\php\php-win.exe,下面就会自动识别php版本-->按确定后就回到CLI Interpreters页面,下拉框中选择你刚刚配置的PHP


4.File-->settings-->Languages&Frameworks-->PHP-->Debug-->修改xdebug中的Debug port和zend Debugger中的Debug port为9000


5.File-->settings-->Languages&Frameworks-->PHP-->Debug-->DBGp Proxy-->IDE key填PHPSTORM,Host填localhost,Port填9000


6.File-->settings-->Languages&Frameworks-->PHP-->Servers-->点击“+”,Name中填localhost,Host填localhost,Port就填项目的端口80,Debugger中选Xdebug


7.Run-->PHP Web Page-->Name中填localhost,Server选localhost,Start URL就填http://localhost,Browser选你要使用什么浏览器调试,可参考:http://www.yayihouse.com/yayishuwu/chapter/2399


8.重启apache服务,在phpstorm中Run-->Debug 'localhost'-->就会在相应的浏览器中自己打开http://localhost/?XDEBUG_SESSION_START=14390,你就可以在phpstorm中打断点调试了


向大家推荐《Activiti工作流实战教程》:https://xiaozhuanlan.com/activiti
0

有建议,请留言!

  • *您的姓名:

  • *所在城市:

  • *您的联系电话:

    *您的QQ:

  • 咨询问题:

  • 提 交