Xdebug and Netbeans are not communicating with eac

2019-01-27 08:09发布

问题:

I have spent a couple of days surfing the internet to find an answer to my question. I have tried everything I could but have been unsuccessful thus far in solving this problem. Netbeans keeps giving Waiting for Connection (netbeans-xdebug).

I am using the following software:

  • XAMPP Version 1.8.1.
  • Windows 7
  • Netbeans IDE 7.2.1
  • Xdebug 2.2.1

I installed the latest version according via the wizard for the xdebug.org site (http://xdebug.org/wizard.php). Xdebug is working according to phpinfo().The HMTL output in my browser (Firefox 17.0.1) shows xdebug code. However this is not communicated back to netbeans. Using Netstat via command prompt (Run -> cmd.exe) shows that there is a TCP connection on port 9000. However , nothing is reported back in Netbeans.

I have tried several different alternatives, for example:

  • Installing a similar IDE, Eclipse PDT. Eclipse shows that Xdebug is
    working. However, because Eclipse is lacking functions I need I
    wanted to use Netbeans.
  • Installing Netbeans on Ubuntu 12.04 LTS.
    Still the same problem. Netbeans not working (waiting for
    connection). Also output in browsers shows that Xdebug is working.

回答1:

Whenever I install on a new Linux machine: "php xdebug" and netbeans
I run these simple steps and I've always managed to corect integration of xdebug on netbeans.
So with the data you provide, I can only help you solve, the half of your problem.
Allowing you to connect on Linux machines:

Installation with pecl:

# apt-get install php5-dev php-pear
# pecl install xdebug

Or direct installation:

# apt-get install php5-xdebug

find the library:

# find / -name 'xdebug.so'
/usr/lib/php5/20090626+lfs/xdebug.so

Edit phi.ini file:

...

zend_extension=/usr/lib/php5/20090626+lfs/xdebug.so
xdebug.remote_enable=1
xdebug.remote_handler=dbgp
xdebug.remote_mode=req
xdebug.remote_host=127.0.0.1
xdebug.remote_port=9000

...

Restart web-server in your case: Apache

$ /etc/init.d/apache2 restart


According to what you have posted:

Installing Netbeans on Ubuntu 12.04 LTS.

I have used the installation method "apt-get" for distributions ".deb". If you are using a distribution ".rpm" can do the same with "yum"

Many of these commands are surely simplified within the xampp.
But if you running this commands from console will not affect the final result.


Another important note about Windows's machines and Linux's machines,
You should check that your firewall rules are allowing to establish a connection from netbeans to xdebug.



回答2:

I know this is old but for people using Ubuntu this might help.

OS Version = Ubuntu 14.04.3 LTS; Codename: trusty
PHP Version = PHP 5.5.9-1ubuntu4.11 (cli) (built: Jul  2 2015 15:17:32) 
Apache Version = Server version: Apache/2.4.7 (Ubuntu)

Procedure

  1. Install xdebug for php5
sudo apt-get install php5-xdebug
  1. Open php.ini and add the following lines below (usually sudo vim /etc/php5/apache2/php.ini)
xdebug.remote_enable=On;
xdebug.remote_host=127.0.0.1
xdebug.remote_port=9000;
xdebug.remote_handler="dbgp"; 
  1. Restart apache and your good to go
sudo service apache2 restart

Note 1: I have not tried doing this without firefox add-on for xdebug, so if after doing the procedure above and still to no avail, download the add-on for firefox Easy Xdebug

Note 2: I did not touch the PHP Configuration of Netbeans

Note 3: I did not touch xdebug.ini