如何在我的 php 上启用 XDebug 扩展?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/13534733/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-25 05:38:29  来源:igfitidea点击:

How to enable XDebug extension on my php?

php

提问by skiabox

I am running php on a macbook pro running mountain lion. Mountain lion comes with XDebug pre-installed, so based on a tutorial I've found , I made three steps. First I've uncomment this line in my php.ini :

我正在运行山狮的 macbook pro 上运行 php。Mountain Lion 预装了 XDebug,所以根据我找到的教程,我做了三个步骤。首先,我在 php.ini 中取消注释这一行:

zend_extension="/usr/lib/php/extensions/no-debug-non-zts-20090626/xdebug.so"

Secondly I've uncomment this line in my php.ini :

其次,我在 php.ini 中取消了这一行的注释:

xdebug.remote_enable=1

And finally I restarted the apache server with :

最后我用以下命令重新启动了 apache 服务器:

sudo apachectl restart

The problem is that I see no xdebug appearing in my php details when I run a phpinfo(). Thank you.

问题是当我运行 phpinfo() 时,我的 php 详细信息中没有出现 xdebug。谢谢你。

PS : The path of the above xdebug.so file is correct.

PS:上面xdebug.so文件的路径是正确的。

回答by skiabox

I am answering my own question because Mountain Lion is a special case when it comes to running XDebug.

我正在回答我自己的问题,因为 Mountain Lion 在运行 XDebug 时是一个特例。

As you can see here,mountain lion comes with an older xdebug.solibrary. So the user must re-compile the library himself.

正如您在此处看到的,山狮带有一个较旧的xdebug.so图书馆。所以用户必须自己重新编译库。

Here is how to do it.

这是如何做到的。

  1. Download the latest version here.(We get the file under the sourcelink.)
  2. Unpack the downloaded file with tar -xvzf xdebug-2.2.1.tgz
  3. Run cd xdebug-2.2.1
  4. Run phpize
  5. Run ./configure
  6. Run make
  7. Run sudo cp modules/xdebug.so /usr/lib/php/extensions/no-debug-non-zts-20090626
  8. Restart the web server with sudo apachectl restart
  1. 点击这里下载最新版本。(我们在source链接下得到文件 。)
  2. 解压下载的文件 tar -xvzf xdebug-2.2.1.tgz
  3. cd xdebug-2.2.1
  4. phpize
  5. ./configure
  6. make
  7. sudo cp modules/xdebug.so /usr/lib/php/extensions/no-debug-non-zts-20090626
  8. 使用以下命令重新启动 Web 服务器 sudo apachectl restart

回答by Paul

Check you are editing the same php.ini that shows up in phpinfo() in the broswer.

检查您正在编辑浏览器中 phpinfo() 中显示的相同 php.ini。

Here are my settings (I'm also on a Macbook Pro on Mountain Lion btw):

这是我的设置(顺便说一句,我也在 Mountain Lion 上的 Macbook Pro 上):

xdebug.var_display_max_children = 999
xdebug.var_display_max_data = 99999
xdebug.var_display_max_depth = 100


;zend_extension_ts=php_xdebug.dll
xdebug.remote_enable=On
xdebug.remote_host=localhost
xdebug.remote_port=9000
xdebug.remote_handler=dbgp

Works for me. Does any of that help?

为我工作。这些有帮助吗?

回答by perso58jm

This set of instructions worked for me.

这套说明对我有用。

It successfully uses OSX Mountain Lion'snative Apache2and XDebugtogether with MacGDBpand a Safari extension called XDebug Helper.

它成功地使用OSX Mountain Lion's本地Apache2XDebug一起MacGDBp和Safari的扩展名为XDebug Helper