是否可以在Ubuntu上使用xdebug? [英] Is it possible to use xdebug on Ubuntu?

查看:189
本文介绍了是否可以在Ubuntu上使用xdebug?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试调试一些PHP代码,并想下载适用于PHP的XDebug调试器.我所看到的全部是可供下载的Windows二进制文件.可以在Ubuntu上使用它吗?

I am trying to debug some PHP code and wanted to download the XDebug debugger for PHP. All I see there is Windows binaries for downloading. Is it at all possible to use it on Ubuntu?

推荐答案

在终端中执行以下命令.

Execute the following commands in your terminal.

下载Xdebug-如果您的计算机上尚未安装PHP5,则需要按照其他说明进行操作.

Download Xdebug - you will need to follow alternate instructions if you don't have PHP5 working on your machine already.

sudo apt-get install php5-xdebug

该软件包应该为您修改INI文件,以防万一您需要自己对其进行编辑以将其打开并进行以下修改-在Ubuntu上,通常为/etc/php5/apache2/php.ini-添加下一行.

The package should modify your INI file for you, but just in case you need to edit it yourself open it up and make the following modification - on Ubuntu its typically at /etc/php5/apache2/php.ini - add the following line.

zend_extension="/usr/lib/php5/20110331/xdebug.so"

该路径在您的系统上可能有所不同-只需确保它是您计算机上xdebug.so文件的完全限定路径即可.还请记住注释掉对Zend Debugger的所有引用-您不能同时运行两者.

That path might be a little different on your system - just make sure its a fully qualified path to the xdebug.so file on your machine. Also remember to comment out any references to the Zend Debugger - you can't run both at the same time.

现在重新启动Apache.

Now restart Apache.

sudo /etc/init.d/apache2 restart

您可能还需要启用html_errors.在/etc/php5/apache2/php.ini中搜索html_errors并确保将其设置为On.还需要重新启动Apache.

You may also need want enable html_errors. Search for html_errors in /etc/php5/apache2/php.ini and make sure it is set to On. A restart of Apache is also required.

html_errors = On

使用phpinfo()仔细检查以确保所有内容均已正确安装-您可能还希望在php.ini文件中设置Xdebug的配置.

Double-check with phpinfo() to make sure that everything is installed properly - you may also want to set configurations for Xdebug in your php.ini file.

这篇关于是否可以在Ubuntu上使用xdebug?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆