【问题标题】:MAC OS El Capitan 10.11: Install XDEBUGMAC OS El Capitan 10.11:安装 XDEBUG
【发布时间】:2016-08-21 14:00:16
【问题描述】:

我正在寻找调试 php 脚本的方法。在互联网上,我发现了我可以使用 MacGDBp + XDebug 做到这一点的信息。 当我尝试在 Shell 中使用 PECL 进行安装时:

sudo pecl install xdebug

The next error have been occured:

downloading xdebug-2.4.0.tgz ...

Starting to download xdebug-2.4.0.tgz (264,832 bytes)
.....................done: 264,832 bytes

76 source files, building
running: phpize
grep: /usr/include/php/main/php.h: No such file or directory

grep: /usr/include/php/Zend/zend_modules.h: No such file or directory

grep: /usr/include/php/Zend/zend_extensions.h: No such file or directory

Configuring for:
PHP Api Version:

Zend Module Api No:

Zend Extension Api No:

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

帮我找到解决这个问题的方法。

【问题讨论】:

  • 你可以尝试通过自制软件安装它吗
  • 没有。我应该先安装 BREW 吗?
  • 如果您收到"cannot find autoconf" 错误,那么您应该首先安装"autoconf"。如果您使用homebrew,那么您可以使用以下命令安装 autoconf:brew install autoconf

标签: php xdebug osx-elcapitan pecl


【解决方案1】:

为了使用 xdebug 进行调试,我使用了以下步骤

为了安装 php72,我使用 brew 安装了以下命令:

brew install homebrew/php/php72-xdebug

我在 php.ini 文件的底部添加了以下命令:

zend_extension=/usr/local/Cellar/php72-xdebug/2.6.0/xdebug.so

注意:如果您需要使用 brew 搜索 xdebug 的版本:

brew search xdebug

【讨论】:

  • 我收到错误 - Error: homebrew/php was deprecated. This tap is now empty as all its formulae were migrated.
【解决方案2】:

XDebug 默认可用。只需通过

启用它

1) sudo nano /etc/php.ini(如果文件尚不存在,则首先是sudo cp /etc/php.ini.default /etc/php.ini

2) 在最后添加这些行(用ls ls /usr/lib/php/extensions/验证路径)

[Xdebug]
zend_extension="/usr/lib/php/extensions/no-debug-non-zts-20121212/xdebug.so"

3) 使用sudo apachectl restart重启apache

4) 通过php -m | grep xdebug验证

【讨论】:

  • 我正在尝试做第一步:使用 VIW 编辑 /etc/php.ini,但它会创建新的 PHP.ini 文件。正常吗?
  • sudo cp /etc/php.ini.default /etc/php.ini 然后用sudo nano /etc/php.ini编辑它
  • 我正在尝试但是 - cp: /etc/php.ini.default: 没有这样的文件或目录
  • 试试sudo cp /private/etc/php.ini.default /private/etc/php.ini
  • cp: /private/etc/php.ini.default: 没有这样的文件或目录...但是我可以在那个目录中找到 php.ini 文件。
【解决方案3】:

Mike Chamberlain 的出色回应几乎让 xdebug 使用 Mac OS Sierra 10.12 与 NetBeans 一起工作。只需进行两项更改: 在第 2 步中,之后 zend_extension="/usr/lib/php/extensions/no-debug-non-zts-20131226/xdebug.so" 还添加 xdebug.remote_enable=1

这是必要的,因为预编译的 .so 文件禁用了 xdebug 远程访问。 NetBeans 和其他工具需要启用它。

【讨论】:

    猜你喜欢
    • 2016-03-15
    • 2017-04-19
    • 1970-01-01
    • 1970-01-01
    • 2020-05-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多