从1开始的PHPStorm+Xdebug包搭建不包使用教程

PHPStorm+Xdebug

前言:出处

一、工具

  • PHPStorm

  • brew

  • php7.4

  • xdebug

  • zsh

二、开箱

1、PHP配置


# 安装php7.4,替换本地的php

brew install php

echo  'export PATH="/usr/local/opt/php/sbin:$PATH"' >> ~/.zshrc

source ~/.zshrc

# 手动启动

php-fpm -D

# 暴力关闭

killall php-fpm

# 安装xdebug扩展,如果报错,一般是缺少依赖,直接brew install xxx即可

pecl install xdebug

# 查找php.ini,php-cli和php-fpm用的是同一个ini

php --ini

Configuration File (php.ini) Path: /usr/local/etc/php/7.4

Loaded Configuration File: /usr/local/etc/php/7.4/php.ini

Scan for additional .ini files in: /usr/local/etc/php/7.4/conf.d

Additional .ini files parsed: /usr/local/etc/php/7.4/conf.d/ext-opcache.ini

# 修改

vim /usr/local/etc/php/7.4/php.ini

[xdebug]

;我不会告诉你docker这里使用docker.for.mac.localhost

xdebug.remote_host=localhost

xdebug.remote_connect_back=0

;防止端口冲突

xdebug.remote_port=9001

;标识

xdebug.idekey=PHPSTORM

xdebug.remote_autostart=1

xdebug.remote_enable=1

xdebug.cli_color=1

xdebug.profiler_enable=0

xdebug.remote_handler=dbgp

xdebug.remote_mode=req

;确保这个日志文件存在

xdebug.remote_log = /var/log/xdebug.log

xdebug.var_display_max_children=-1

xdebug.var_display_max_data=-1

xdebug.var_display_max_depth=-1

2、PHPStorm配置

Q: 为什么用PHP Remote Debug

A:可以不用下载浏览器xdebug插件

从1开始的PHPStorm+Xdebug包搭建不包使用教程

从1开始的PHPStorm+Xdebug包搭建不包使用教程

从1开始的PHPStorm+Xdebug包搭建不包使用教程

从1开始的PHPStorm+Xdebug包搭建不包使用教程

从1开始的PHPStorm+Xdebug包搭建不包使用教程

三、成果

从1开始的PHPStorm+Xdebug包搭建不包使用教程

四、参考文献

本作品采用《CC 协议》,转载必须注明作者和本文链接
《L04 微信小程序从零到发布》
从小程序个人账户申请开始,带你一步步进行开发一个微信小程序,直到提交微信控制台上线发布。
《G01 Go 实战入门》
从零开始带你一步步开发一个 Go 博客项目,让你在最短的时间内学会使用 Go 进行编码。项目结构很大程度上参考了 Laravel。
讨论数量: 0
(= ̄ω ̄=)··· 暂无内容!

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