mac使用phpstorm开启xdebug

使用laravel进行开发,可以通过使用dd,dump等方法进行调试,但是现在我想通过xdebug一步步调试,看看框架都做了什么流程,在此记录一下如何使用phpstorm开启xdebug

安装xdebug扩展

一句话搞定安装扩展

pecl install xdebug

添加配置

[xdebug]
zend_extension="xdebug.so"
xdebug.remote_autostart=1
xdebug.default_enable=1
xdebug.remote_port=9001
xdebug.remote_host=127.0.0.1
xdebug.remote_connect_back=1
xdebug.remote_enable=1
xdebug.idekey=PHPSTORM

使用phpinfo()查看是否安装完成xdebug扩展,若出现以下内容,则说明成功安装xdebug扩展

mac使用phpstorm开启xdebug

并查看xdebug.remote_enable,确保为on开启
mac使用phpstorm开启xdebug

配置phpstorm

我使用的phpstorm版本为2019.3

点击phpstorm左上角phpstorm>>Preferences

点击Languages & Frameworks > PHP > Debug,这里配置Debug port与我们配置的xdebug.remote_port对应,这里配置9001
mac使用phpstorm开启xdebug

点击Languages & Frameworks > PHP > Debug > DBGp Proxy,配置本地信息

mac使用phpstorm开启xdebug

点击Languages & Frameworks > PHP > Servers,这里配置我们需要调试的域名,如下按照你的域名去配置即可

mac使用phpstorm开启xdebug

点击这里添加配置

mac使用phpstorm开启xdebug

点击添加PHP Web Page
mac使用phpstorm开启xdebug

这里选择添加之前Servers添加的配置
mac使用phpstorm开启xdebug

配置完成后,就可以愉快的使用phpstorm进行debug

本作品采用《CC 协议》,转载必须注明作者和本文链接
《L02 从零构建论坛系统》
以构建论坛项目 LaraBBS 为线索,展开对 Laravel 框架的全面学习。应用程序架构思路贴近 Laravel 框架的设计哲学。
《G01 Go 实战入门》
从零开始带你一步步开发一个 Go 博客项目,让你在最短的时间内学会使用 Go 进行编码。项目结构很大程度上参考了 Laravel。
讨论数量: 0
(= ̄ω ̄=)··· 暂无内容!

讨论应以学习和精进为目的。请勿发布不友善或者负能量的内容,与人为善,比聪明更重要!