PHPSTORM+GOOGLE浏览器+XDEBUG进行PHP断点调试

相信用java,或者nodejs的人,一定体会过用断点调试来查找程序错误的优点与方便。php也有断点调试功能,就是配置起来有一些麻烦。
准备工作:

  1. 安装xdebug
    如果你用的是phpstudy的话,只需要把xdebug的拓展打开就好了。如果用的其他集成开发包,或者自己搭建的php环境的话。就需要自己去下载xdebug,然后修改php.ini,具体方法我就不赘述了。
    php.ini添加一下代码
[XDebug]
xdebug.profiler_output_dir="D:\phpStudy\tmp\xdebug"
xdebug.trace_output_dir="D:\phpStudy\tmp\xdebug"
zend_extension="D:\phpStudy\php\php-5.4.45\ext\php_xdebug.dll" 
xdebug.remote_enable=ON
xdebug.profiler_enable = Off
xdebug.remote_handler = dbgp
xdebug.remote_host = localhost
xdebug.remote_mode = req
xdebug.remote_port = 9000
xdebug.idekey=PHPSTORM

zend_extension=”D:\phpStudy\php\php-5.4.45\ext\php_xdebug.dll” 这里填写自己安装的路径,如果phpstudy安装的话,就不需要修改。
2. 安装xdebug helper

我用的google浏览器,其他的也可以,下载对应的xdebug helper 就可以了。
配置xdebug helper
这里写图片描述
拓展程序里或者右键那个小虫子选择选项
这里写图片描述
选择ide key phpstorm 其他的可以不用管

  1. 安装 jetbrains ide suppurt
    这里写图片描述
    安装好了,然后点击phpstrom里面的电话按钮
    这里写图片描述
    到这里,准备工作基本上就做好了。接下来我们要配置一下phpstorm
    1.这里写图片描述
    配置服务器,填写你本地的虚拟域名。
    2.这里写图片描述
    点击edit
    3.这里写图片描述
    点击左上角+好,添加一个php web application
    serve选择你本地配置好的服务器域名,就是第一步配置的。
    然后填写开始的url地址。点击ok基本上就完事了。

最后调试
这里写图片描述
右键行号空白处,然后浏览器访问,程序会停在断点那里

发布了33 篇原创文章 · 获赞 1 · 访问量 8322

猜你喜欢

转载自blog.csdn.net/u012914309/article/details/65440609