如何让 Xdebug 在 Mac 上运行
我在这上面花了很多时间,但没有最终产品。
- 安装了 MAMP。
- 找到“make”(安装在不同的文件夹中)
- 安装了缺少的 autoconf,因此我可以运行 phpize
- 下载、编译并安装了 xdebug 根据:
http://www.xdebug.org/find-binary.php
- 进行了必要的更改以更正 php.ini。
- 重新启动 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.
- Installed MAMP.
- Found "make" (was installed in different folder)
- Installed autoconf which was missing so I can run phpize
- Downloaded, compiled and installed xdebug according to:
http://www.xdebug.org/find-binary.php
- Made necessary changes to correct php.ini.
- 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
可以下载 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.
现代 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
并查看它们是否都显示i386
或x86_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
thenfile /path/to/mamp/Library/modules/php5.3/libphp5.so
and see if they both showi386
orx86_64
.我刚刚做到了并且成功了。这就是我所做的:
php -d detector_unicode=0 go-pear.phar
echo "export PATH=$PATH:/Users/the-user/pear/bin" >>> .bash_profile
。 .bash_profile
sudo pecl install xdebug
一样简单zend_extension
,如果正确则取消注释该行,如果不正确则更改它(在我的例子中它是正确的)就是这样。除非你想从 IntelliJ Idea 进行调试。在这种情况下,我必须将 /etc/php.ini.default 复制到 /etc/php.ini
享受 PHP 的乐趣
I just did it and it worked. Here is what I did:
php -d detect_unicode=0 go-pear.phar
echo "export PATH=$PATH:/Users/the-user/pear/bin" >> .bash_profile
. .bash_profile
sudo pecl install xdebug
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
只是为了指出显而易见的事情,但我一直在这上面浪费时间;在 apache2 环境中,请记住重新启动 apache2 以使更改生效。
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.