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 协议》,转载必须注明作者和本文链接
《L01 基础入门》
我们将带你从零开发一个项目并部署到线上,本课程教授 Web 开发中专业、实用的技能,如 Git 工作流、Laravel Mix 前端工作流等。
《L03 构架 API 服务器》
你将学到如 RESTFul 设计风格、PostMan 的使用、OAuth 流程,JWT 概念及使用 和 API 开发相关的进阶知识。
讨论数量: 0
(= ̄ω ̄=)··· 暂无内容!

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