当前位置:网站首页>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环境变量
编辑这个文件就可以了,然后重启一个终端就可以。

边栏推荐
- 上海字节面试问题及薪资福利
- [binary tree] binary tree path finding
- 目标检测中的BBox 回归损失函数-L2,smooth L1,IoU,GIoU,DIoU,CIoU,Focal-EIoU,Alpha-IoU,SIoU
- 京东商品详情页API接口、京东商品销量API接口、京东商品列表API接口、京东APP详情API接口、京东详情API接口,京东SKU信息接口
- 分布式事务解决方案之TCC
- Getting started with DES encryption
- Explication contextuelle du langage Go
- Educational Codeforces Round 22 B. The Golden Age
- 爬虫练习题(三)
- 淘宝店铺发布API接口(新),淘宝oAuth2.0店铺商品API接口,淘宝商品发布API接口,淘宝商品上架API接口,一整套发布上架店铺接口对接分享
猜你喜欢
随机推荐
What is dependency injection (DI)
Simple case of SSM framework
Leetcode 1189 maximum number of "balloons" [map] the leetcode road of heroding
The year of the tiger is coming. Come and make a wish. I heard that the wish will come true
Paper reading [semantic tag enlarged xlnv model for video captioning]
《2022中国低/无代码市场研究及选型评估报告》发布
Forkjoin is the most comprehensive and detailed explanation (from principle design to use diagram)
Go 语言的 Context 详解
爬虫练习题(三)
Common skills and understanding of SQL optimization
Three level menu data implementation, nested three-level menu data
驱动开发中platform设备驱动架构详解
Codeforces Round #416 (Div. 2) D. Vladik and Favorite Game
Type de texte de commutation d'entrée et de mot de passe de l'applet natif
Mybaits multi table query (joint query, nested query)
5阶多项式轨迹
OpenSergo 即将发布 v1alpha1,丰富全链路异构架构的服务治理能力
C nullable type
成为资深IC设计工程师的十个阶段,现在的你在哪个阶段 ?
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









