简体   繁体   English

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

[英]How to enable XDebug extension on my php?

I am running php on a macbook pro running mountain lion. 我在运行山狮的macbook pro上运行php。 Mountain lion comes with XDebug pre-installed, so based on a tutorial I've found , I made three steps. Mountain Lion预装了XDebug,所以根据我发现的教程,我做了三个步骤。 First I've uncomment this line in my php.ini : 首先,我在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(). 问题是当我运行phpinfo()时,我看到我的php细节中没有出现xdebug。 Thank you. 谢谢。

PS : The path of the above xdebug.so file is correct. PS:上面的xdebug.so文件的路径是正确的。

I am answering my own question because Mountain Lion is a special case when it comes to running XDebug. 我正在回答我自己的问题,因为在运行XDebug时,Mountain Lion是一个特例。

As you can see here, mountain lion comes with an older xdebug.so library. 正如你在这里看到的,山狮配有一个较旧的xdebug.so库。 So the user must re-compile the library himself. 因此用户必须自己重新编译库。

Here is how to do it. 这是怎么做的。

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

Check you are editing the same php.ini that shows up in phpinfo() in the broswer. 检查您是否正在编辑在broswer中显示在phpinfo()中的相同php.ini。

Here are my settings (I'm also on a Macbook Pro on Mountain Lion btw): 这是我的设置(我也在Mountain Lion btw的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? 这有什么帮助吗?

This set of instructions worked for me. 这套说明适合我。

It successfully uses OSX Mountain Lion's native Apache2 and XDebug together with MacGDBp and a Safari extension called XDebug Helper . 它成功地使用了OSX Mountain Lion's原生Apache2XDebug以及MacGDBp和一个名为XDebug Helper的Safari扩展。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM