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

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(7)
在终端中执行以下命令。
下载 Xdebug - 如果您的计算机上尚未安装 PHP5,则需要遵循备用说明。
该软件包应该为您修改您的 INI 文件,但以防万一您需要自己编辑它,打开它并进行以下修改 - 在 Ubuntu 上通常位于 /etc/php5/apache2/php.ini - 添加以下行。
该路径在您的系统上可能略有不同 - 只需确保它是您计算机上 xdebug.so 文件的完全限定路径。另请记住注释掉对 Zend 调试器的任何引用 - 您不能同时运行两者。
现在重新启动 Apache。
您可能还需要启用 html_errors。在 /etc/php5/apache2/php.ini 中搜索 html_errors 并确保将其设置为 On。还需要重新启动 Apache。
仔细检查 phpinfo() 以确保一切都安装正确 - 您可能还想在 php.ini 文件中设置 Xdebug 的配置。
Execute the following commands in your terminal.
Download Xdebug - you will need to follow alternate instructions if you don't have PHP5 working on your machine already.
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.
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.
Now restart 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.
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 上(至少在 14.04 LTS 上),我还需要激活该模块。所以,我总共做了:
服务器重新启动后,xdebug 可用。
On a newer Ubuntu (at least on 14.04 LTS), I needed to activate the module as well. So, in total I did:
After a restart of the server, xdebug was available.
这篇文章对我在运行 PHP7 的 Ubuntu 16.04 中提供了帮助:
文章链接
This article was what helped me in Ubuntu 16.04 running PHP7:
Link to article
::ubuntu 18.04、php7.2、apache2::
1. 首先使用 sudo apt-get install php-xdebug 安装 xdebug。
2. 这将创建文件 /etc/php/7.2/mods-available/xdebug.ini
3.您可以运行
sudo phpenmod xdebug
4.使用
sudo nano /etc/php/7.2/mods-available/xdebug.ini
打开xdebug.ini5.你只能看到这一行:zend_extension=xdebug.so
6. 假设在 localhost 和 netbeans IDE 上运行 php apache,请将以下行添加到 xdebug.ini
注意: xdebug.idekey 和 xdebug.remote_port 可以从 netbeans 工具->optins->php->debug 获取
::ubuntu 18.04, php7.2, apache2::
1. First install xdebug using
sudo apt-get install php-xdebug
.2. This will create file /etc/php/7.2/mods-available/xdebug.ini
3. You can run
sudo phpenmod xdebug
4. open xdebug.ini using
sudo nano /etc/php/7.2/mods-available/xdebug.ini
5. you can see only the line: zend_extension=xdebug.so
6. assuming running php apache on localhost and netbeans IDE, add following line to xdebug.ini
N.B: xdebug.idekey and xdebug.remote_port can be obtained from netbeans tools->optins->php->debug
为最新版本的 LAMPP 安装 XDEBUG 的正确方法:
下载:XDEBUG 最新版本称为源。
将文件提取到任意文件夹。
使用终端打开此文件夹。
将 XXX 更改为您实际的 php 版本
在终端中执行以下命令。
现在我们需要编辑文件 php.ini
在终端中打开文件 php.ini 所在的文件夹:
添加到文件末尾:
在终端中打开 LAMPP 文件夹
现在重新启动 Apache。
现在您可以检查 phpinfo() 以查看 XDEBUG 是否已安装。
Proper way to install XDEBUG for newest version of LAMPP:
Download: XDEBUG latest version called source.
Extract file to any folder.
Open this folder with terminal.
Change X.X.X to Your actually version of php
Execute the following commands in your terminal.
Now we need edit file php.ini
Open folder where is file php.ini in terminal:
Add to the end of file this:
Open LAMPP folder in terminal
Now restart Apache.
And now You can check phpinfo() to see XDEBUG is installed.
尝试从源代码编译,这就是我在 Mac 上所做的。
否则,这可能对您有帮助: http://ubuntuforums.org/showthread.php?t=525257< /a>
Try compiling from source, that's what I do on my mac.
Otherwise, this might help you: http://ubuntuforums.org/showthread.php?t=525257