gpt4 book ai didi

xdebug - 无法使用 Homebrew 在 Mac 上安装 xdebug

转载 作者:行者123 更新时间:2023-12-03 06:56:41 27 4
gpt4 key购买 nike

我对使用 Homebrew 不太熟悉,但我喜欢它。它是如此容易。我正在尝试安装 Xdebug。网络上的一些帖子说要这样做:

brew install xdebug

但是这不起作用。我得到:错误,没有可用的公式。

我做了brew search xdebug,它返回了:

josegonzalez/php/php53-xdebug    josegonzalez/php/php54-xdebug

我尝试了 brew install 的几个不同版本,包括 brew install php53-xdebug,但仍然没有运气。有人能帮我吗?我在 Xdebug 的网站上找不到任何有关使用 Homebrew 的内容,但网络上的帖子似乎表明这是可能的。

最佳答案

//自 2023 年起工作

由于 homebrew 删除了额外的 php 存储库,其中包含已安装 xdebug 的版本,因此您必须手动安装它。

摘要

  1. brew install php@<php version>对于 PHP
  2. 更新您的路径
  3. pecl install xdebug对于 xdebug

完整的分步示例

# update homebrew
brew update

# install a version of php, e.g. 7.0
brew install php@7.0

# now they tell you how to link it, in my case
echo 'export PATH="/usr/local/opt/php@7.0/bin:$PATH"' >> ~/.bash_profile
echo 'export PATH="/usr/local/opt/php@7.0/sbin:$PATH"' >> ~/.bash_profile

# reload the file with the updated path, so we can use pecl
source ~/.bash_profile

# check that the path is to the correct php executable,
# and pecl is available
which pecl
# returns: /usr/local/opt/php@7.0/bin/pecl

# install xdebug, see https://xdebug.org/docs/install#pecl
pecl install xdebug

# check that everything worked
php --version
# should show a xdebug version
# like: with Xdebug v2.6.0, Copyright (c) 2002-2018, by Derick Rethans

pecl install xdebug上述步骤结束于

Build process completed successfully
Installing '/usr/local/Cellar/php@7.0/7.0.30/pecl/20151012/xdebug.so'
install ok: channel://pecl.php.net/xdebug-2.6.0
Extension xdebug enabled in php.ini

所以我什至不需要启用 xdebug.sophp.ini .



如果您需要xdebug的特殊版本(例如,您的 IDE 不喜欢 3.x.x 版本),您可以安装特定版本 xdebug-$VERSION ,例如pecl install xdebug-2.9.8 。您可以在 list of available versions 上找到它们(感谢Bower)

关于xdebug - 无法使用 Homebrew 在 Mac 上安装 xdebug,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12712017/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com