当前位置:网站首页>mac版php装xdebug环境(m1版)
mac版php装xdebug环境(m1版)
2022-07-07 00:26:00 【ARCHER359】
笔者环境依赖
1.php7.4
2.macOS 12
3.apache2
4.xdebug3.1.4
5.phpstorm
php7.4安装
brew install php7.4
安装完后记得把brew自动更新软件关了,要不然下次出新版php7.4可能会导致xdebug重新安装
apache2安装(好像mac自带,我又重装了一遍)
brew install apache2
笔者默认web根 /opt/homebrew/var/www 配置文件目录/opt/homebrew/etc/httpd
xdebug安装
去官网下载最新xdebug

下载完成后我们来到php的bin目录,我这里是/opt/homebrew/Cellar/[email protected]/7.4.29/bin然后执行sudo ./pecl install xdebug(刚刚下载的xdebug压缩包),官方的是用arch -arm64 sudo pecl install xdebug命令安装我这里没成功。
在编译完成后如果爆了缺少一些目录的警告,并且没有生成xdebug.so的话,就把缺少的目录创建一下记得给上权限,然后重新编译生成xdebug.so,编译成功后输入php -m命令查看是否安装成功。

重点来了
修改php.ini并添加以下内容。
[xdebug]
zend_extension ="/opt/homebrew/Cellar/[email protected]/7.4.29/pecl/20190902/xdebug.so";根据自己修改目录
xdebug.idekey="PHPSTORM"
xdebug.client_host=localhost
; 端口ID,phpstorm 设置须一致
xdebug.client_port=9003
;开启xdebug支持,不同的mode的不同的用途,详细说明请看官方文档
xdebug.mode = debug ;如果要多个模式一起开启,就用`,`分隔开就行
xdebug.profiler_append = 0
xdebug.profiler_output_name = cachegrind.out.%p
xdebug.start_with_request = default|yes|no|trigger ;这里与原来不同了,原来如果要开启trace或profile,用的是enable_trace,enable_profile等字段
xdebug.trigger_value=StartProfileForMe ;这里就是原来的profile_trigger_value,trace_trigger_value
xdebug.output_dir = /tmp ;输出文件路径,原来是output_profiler_dir,trace_dir分别设置,现在统一用这个设置就可以验证是否成功配置

phpstorm配置
先提前把php配置好,然后开始debug配置
1.创建一个服务器

2.设置Dgbp代理,要和php.ini配置的一样。

3.修改调试端口,要和php.ini一样
4. 创建一个php web页面,服务器选我们第一步创建的那个,点击验证可以检测我们的调试配置。


环境测试
打开小电话后,我们来到浏览器,配置好xdebug插件,开启httpd。
sudo brew services start httpd



可以看到成功的开始了debug 。
后续可能遇到的问题
1.httpd不解析php
修改httpd.conf添加一行,根据自己php安装目录修改
LoadModule php7_module /opt/homebrew/Cellar/[email protected]/7.4.29/lib/httpd/modules/libphp7.so
不行的话再加个一行AddType application/x-httpd-php .php试试
2.没有php环境变量
编辑这个文件就可以了,然后重启一个终端就可以。

边栏推荐
猜你喜欢

Simple case of SSM framework

产业金融3.0:“疏通血管”的金融科技

三级菜单数据实现,实现嵌套三级菜单数据
上海字节面试问题及薪资福利

Unity keeps the camera behind and above the player

JD commodity details page API interface, JD commodity sales API interface, JD commodity list API interface, JD app details API interface, JD details API interface, JD SKU information interface

目标检测中的BBox 回归损失函数-L2,smooth L1,IoU,GIoU,DIoU,CIoU,Focal-EIoU,Alpha-IoU,SIoU

Message queuing: how to ensure that messages are not lost

What is message queuing?

力扣102题:二叉树的层序遍历
随机推荐
Lombok plug-in
In memory, I moved from CSDN to blog park!
JSP setting header information export to excel
JD commodity details page API interface, JD commodity sales API interface, JD commodity list API interface, JD app details API interface, JD details API interface, JD SKU information interface
Codeforces Round #416 (Div. 2) D. Vladik and Favorite Game
4. 对象映射 - Mapping.Mapster
[论文阅读] A Multi-branch Hybrid Transformer Network for Corneal Endothelial Cell Segmentation
How to get free traffic in pinduoduo new store and what links need to be optimized in order to effectively improve the free traffic in the store
Taobao store release API interface (New), Taobao oauth2.0 store commodity API interface, Taobao commodity release API interface, Taobao commodity launch API interface, a complete set of launch store i
Pytorch builds neural network to predict temperature
Taobao Commodity details page API interface, Taobao Commodity List API interface, Taobao Commodity sales API interface, Taobao app details API interface, Taobao details API interface
Flink SQL realizes reading and writing redis and dynamically generates hset key
Forkjoin is the most comprehensive and detailed explanation (from principle design to use diagram)
1. AVL tree: left-right rotation -bite
目标检测中的损失函数与正负样本分配:RetinaNet与Focal loss
Codeforces Round #416 (Div. 2) D. Vladik and Favorite Game
4. Object mapping Mapster
R language [logic control] [mathematical operation]
MySQL-CentOS7通过YUM安装MySQL
What are the common message queues?