Mac 用pecl安装xdebug

本文详细介绍了在Mac上使用pecl安装xdebug过程中遇到的问题及解决方案,包括权限问题、autoconf缺失、php.h文件找不到以及如何在php.ini中配置xdebug并重启apache。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

1.1直接安装sudo pecl install xdebug

出现错误

WARNING: configuration download directory "/tmp/pear/install" is not writeable.  Change download_dir config variable to a writeable dir to avoid this warning


1.2解决:

cd /

cd /tmp/pear

sudo chmod -R 777 install/



WARNING: channel "pecl.php.net" has updated its protocols, use "pecl channel-update pecl.php.net" to update

1.3解决

sudo pecl channel-update pecl.php.net
Updating channel "pecl.php.net"
Update of Channel "pecl.php.net" succeeded
 


Cannot find autoconf. Please check your autoconf installation and the
$PHP_AUTOCONF environment variable. Then, rerun this script.

ERROR: `phpize' failed

1.4解决 安装homebrew

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew install autoconf


fatal error: 'php.h' file not found
#include "php.h"
         ^~~~~~~
1 error generated.
make: *** [xdebug.lo] Error 1

1.41这里的macOS_10.14.pkg,是自己mac的版本号

sudo installer -pkg /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg -target /

You should add "zend_extension=/usr/lib/php/extensions/no-debug-non-zts-20160303/xdebug.so" to php.ini


1.5将zend_extension=/usr/lib/php/extensions/no-debug-non-zts-20160303/xdebug.so加入t php.ini


1.6重启apache,并测试

sudo apachectl restart

PHP代码

$a = "new string";
xdebug_debug_zval('a');

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值