如何让 Xdebug 在 Mac 上运行

发布于 2024-10-10 09:17:51 字数 766 浏览 0 评论 0原文

我在这上面花了很多时间,但没有最终产品。

  1. 安装了 MAMP。
  2. 找到“make”(安装在不同的文件夹中)
  3. 安装了缺少的 autoconf,因此我可以运行 phpize
  4. 下载、编译并安装了 xdebug 根据:

http://www.xdebug.org/find-binary.php

  1. 进行了必要的更改以更正 php.ini。
  2. 重新启动 MAMP - 但 phpinfo() 不显示 xdebug。

无论我对位于 /Applications/MAMP/conf/php5.3/php.ini 的 php.ini 文件做什么,都不会发生任何变化。该网站仍然加载良好。即使我彻底摧毁它。但这就是 phpinfo() 显示它正在加载的内容。

我在忽略什么?

php.ini

[xdebug]
zend_extension=/Applications/MAMP/bin/php5.3/lib/php/extensions/no-debug-non-zts-20090626/xdebug.so
xdebug.remote_enable=1
xdebug.remote_host=localhost
xdebug.remote_port=9000
xdebug.remote_autostart=1 

I have spent a lot of time on this with no end product.

  1. Installed MAMP.
  2. Found "make" (was installed in different folder)
  3. Installed autoconf which was missing so I can run phpize
  4. Downloaded, compiled and installed xdebug according to:

http://www.xdebug.org/find-binary.php

  1. Made necessary changes to correct php.ini.
  2. Restarted MAMP - but phpinfo() does not show xdebug.

No matter what I do to the php.ini file located at /Applications/MAMP/conf/php5.3/php.ini, nothing changes. The site still loads fine. Even if I nuke it completely. Yet that is what phpinfo() shows it is loading.

What am I overlooking?

php.ini

[xdebug]
zend_extension=/Applications/MAMP/bin/php5.3/lib/php/extensions/no-debug-non-zts-20090626/xdebug.so
xdebug.remote_enable=1
xdebug.remote_host=localhost
xdebug.remote_port=9000
xdebug.remote_autostart=1 

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

凉城已无爱 2024-10-17 09:17:51

可以下载 xdebug 预编译二进制文件的网站整个上午都处于关闭状态(活动状态),这就是我尝试编译自己的网站的原因。

我刚刚发现该网站已重新上线,下载了 xdebug.so 文件,并且现在正在加载。

The site where you can download precompiled binaries of xdebug had been down all morning (activestate) which is why I was trying to compile my own.

I just found out the site was back online, downloaded the xdebug.so file, and it is now loading.

小苏打饼 2024-10-17 09:17:51

现代 MAC 有两种二进制文件 - 32 位和 64 位。验证您的 PHP 是否与 xdebug 匹配:执行 file Applications/MAMP/bin/php5.3/lib/php/extensions/no-debug-non-zts-20090626/xdebug.so 然后 文件 /path/to/mamp/Library/modules/php5.3/libphp5.so 并查看它们是否都显示 i386x86_64

Modern MACs have two kinds of binaries - 32-bit and 64-bit. Verify that you PHP matches your xdebug: do file Applications/MAMP/bin/php5.3/lib/php/extensions/no-debug-non-zts-20090626/xdebug.so then file /path/to/mamp/Library/modules/php5.3/libphp5.so and see if they both show i386 or x86_64.

半寸时光 2024-10-17 09:17:51

我刚刚做到了并且成功了。这就是我所做的:

  • 安装 PECL 以便安装 Xdebug
    • 下载http://pear.php.net/go-pear.phar
    • 在下载目录中执行php -d detector_unicode=0 go-pear.phar
    • 现在将 ~/pear/bin 文件夹添加到您的路径 echo "export PATH=$PATH:/Users/the-user/pear/bin" >>> .bash_profile
    • 并使更改对您的终端可见。。 .bash_profile
  • 安装 Xdebug
    • 现在您已经有了 PECL,就像 sudo pecl install xdebug 一样简单
  • ,现在您需要在 php.ini 中添加一行
    • 我的 mac (Lion) 上的 php.ini 是 /etc/php.ini.default
    • 搜索zend_extension,如果正确则取消注释该行,如果不正确则更改它(在我的例子中它是正确的)

就是这样。除非你想从 IntelliJ Idea 进行调试。在这种情况下,我必须将 /etc/php.ini.default 复制到 /etc/php.ini

享受 PHP 的乐趣

I just did it and it worked. Here is what I did:

  • install PECL in order to install Xdebug
    • download http://pear.php.net/go-pear.phar
    • in the download directory execute php -d detect_unicode=0 go-pear.phar
    • now add the ~/pear/bin folder to your path echo "export PATH=$PATH:/Users/the-user/pear/bin" >> .bash_profile
    • and make the change visible to your terminal . .bash_profile
  • install Xdebug
    • now that you have PECL it's as easy as sudo pecl install xdebug
  • now you need to add a line to php.ini
    • the php.ini on my mac (Lion) is /etc/php.ini.default
    • search for zend_extension and uncomment the line if it is correct or change it if it is not (in my case it was correct)

That's it. Unless you want to debug form IntelliJ Idea. In which case I had to copy /etc/php.ini.default to /etc/php.ini

have fun with PHP

暮色兮凉城 2024-10-17 09:17:51

只是为了指出显而易见的事情,但我一直在这上面浪费时间;在 apache2 环境中,请记住重新启动 apache2 以使更改生效。

sudo apachectl restart

Just to point out the obvious, but one that I keep throwing away time on; in an apache2 environment remember to restart apache2 for the changes to take effect.

sudo apachectl restart
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文