Is it possible to use xdebug on Ubuntu?

2019-01-21 02:14发布

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?

7条回答
forever°为你锁心
2楼-- · 2019-01-21 02:29

::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

xdebug.show_error_trace = 1
xdebug.idekey=netbeans-xdebug
xdebug.default_enable=1
xdebug.remote_enable=1
xdebug.remote_handler=dbgp
xdebug.remote_host=localhost
xdebug.remote_port=9000
xdebug.remote_autostart=1

N.B: xdebug.idekey and xdebug.remote_port can be obtained from netbeans tools->optins->php->debug

查看更多
走好不送
3楼-- · 2019-01-21 02:32

This article was what helped me in Ubuntu 16.04 running PHP7:
Link to article

sudo apt-get install php-xdebug
查看更多
乱世女痞
4楼-- · 2019-01-21 02:33

On a newer Ubuntu (at least on 14.04 LTS), I needed to activate the module as well. So, in total I did:

sudo apt-get install php5-xdebug
sudo php5enmod xdebug

After a restart of the server, xdebug was available.

查看更多
一夜七次
5楼-- · 2019-01-21 02:37

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.

sudo apt-get install php5-xdebug

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"

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.

sudo /etc/init.d/apache2 restart

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

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.

查看更多
姐就是有狂的资本
6楼-- · 2019-01-21 02:43
sudo apt-get install php5-xdebug
查看更多
虎瘦雄心在
7楼-- · 2019-01-21 02:48

Try compiling from source, that's what I do on my mac.

Otherwise, this might help you: http://ubuntuforums.org/showthread.php?t=525257

查看更多
登录 后发表回答