Connection Waiting (netbeans-xdebug) MAMP OS X

Preamble

After a few hours, I was unable to connect NetBeans to xdebug. A few months ago, after switching from the old version of MAMP to MAMP PRO, debugging worked flawlessly. A week ago, he began to become scaly. It would seem that he connects, but does not stop at control points. Restarting NetBeans (v7.0.1) and apache sometimes made it work for a short time.

I really needed it fixed, so I installed the latest version of MAMP PRO (2.1.2). Now I get the message "Waiting for connection" forever.

The testing that I performed

While the message "Waiting for connection" is present with a moving strip, I look to see if it is audible. It...

# lsof -i -n -P |grep 9001 java 6496 tim 230u IPv6 0xffffff80239d8190 0t0 TCP *:9001 (LISTEN) 

In the NetBeans php configuration, I have the interpreter installed: / Applications / MAMP / bin / php / php 5.4.10 / bin / php

Doing the following:

 # /Applications/MAMP/bin/php/php5.4.10/bin/php -i | grep xdebug 

tells me that xdebug is running, like phpinfo ()

I (many times) have confirmed that I have the same port number everywhere. I tried port 9000 and 9001.

Running the tail on xdebug.log and then starting the session from the browser without starting the debugging session in NetBeans gives:

 I: Connecting to configured address/port: localhost:9001. E: Could not connect to client. :-( 

Waiting for a connection message and starting a session from the browser, I get this in the log:

 : Connecting to configured address/port: localhost:9001. I: Connected to client. :-) -> <init xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" fileuri="file:///Users/tim/MAMPSites/facts.tvd.us/htdocs/sendfile/tim.php" language="PHP" protocol_version="1.0" appid="7279" idekey="netbeans-xdebug"><engine version="2.2.1"><![CDATA[Xdebug]]></engine><author><![CDATA[Derick Rethans]]></author><url><![CDATA[http://xdebug.org]]></url><copyright><![CDATA[Copyright (c) 2002-2012 by Derick Rethans]]></copyright></init> -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" status="stopping" reason="ok"></response> 

My php.ini file has the following:

 [xdebug] zend_extension="/Applications/MAMP/bin/php/php5.3.20/lib/php/extensions/no-debug-non-zts-20090626/xdebug.so" xdebug.remote_enable=on xdebug.remote_log="/var/log/xdebug.log" xdebug.remote_host=localhost xdebug.remote_handler=dbgp xdebug.remote_port=9001 xdebug.idekey="netbeans-xdebug" 

Update

I just noticed that the lsof command above shows that NetBeans is listening on ipV6. Preventing the use of java (NetBeans) to use ipV4 does not help.

 launchctl setenv JAVA_TOOL_OPTIONS -Djava.net.preferIPv4Stack=true 

I found a message that suggested a test to confirm that xdebug was working correctly. Create a php file:

 <?php $address = '127.0.0.1'; $port = 9000; $sock = socket_create(AF_INET, SOCK_STREAM, 0); socket_bind($sock, $address, $port) or die('Unable to bind'); socket_listen($sock); $client = socket_accept($sock); echo "connection established: $client"; socket_close($client); socket_close($sock); ?> 

Run it from the command line and load any page in your browser at the end of the URL:

 ?XDEBUG_SESSION_START=nb 

If it displays something like "connection established: Resource ID # 5", xdebug is working correctly. In doing so, I reinstalled Java and NetBeans. I told NetBeans NOT to import my existing settings ... There is still no connection.

Update2

I installed phpStorm IDE for Mac. I have learned enough about this to make the debugger work with the existing MAMP and xdebug settings. I think this confirms the problem with NetBeans.

At the moment, getting this work seems impossible .:(

+8
php xdebug mamp netbeans macos
source share
4 answers

I asked the same thing and got this nice answer: How to track the execution time of each line / block of lines / methods in PHP? besides this, I also answer the current question with another question with the same content.

Some additional notes on this (the material I collected in other SO posts in my research on this issue):

  • The port may also be 9001 (it seems to work for some people, but 9000 does not).
  • Switching to the PHPStorm IDE is a real alternative that solves this problem (since PHPStorm already included a well-functioning xdebug).
  • Download the new version of xdebug through the wizard ( http://xdebug.org/wizard.php ), and if you follow the instructions, you might be lucky.
  • You can disable the firewall.
  • Add to php.ini: xdebug.idekey=netbeans-xdebug .
  • Find out if you have an xdebug.ini file and add the php.ini lines associated with xdebug to this file.
  • you need to undo the comment on the zend_extension line (i.e. delete ; at the beginning) so that Xdebug is loaded.
  • make sure Xdebug is loaded by calling phpinfo () from the PHP file (just to make sure).
+7
source share

Xdebug will only connect if there is an index.php file in the project folder, so make sure you have one.

+5
source share

he works for me now. I have LAMP installed. I changed according to all the answers above, started apache2, and now it flies ... I'm happy ... for some time I decided to switch to phpstorm, but I revised ... changed a bit ... et voila. it works.

Here is what I have in php.ini

 zend_extension = /usr/lib/php5/20121212/xdebug.so xdebug.max_nesting_level = 250 xdebug.auto_trace=On xdebug.remote_enable=On xdebug.remote_port=9001 xdebug.remote_handler=dbgp xdebug.remote_host=localhost xdebug.remote_log="/var/log/xdebug.log" xdebug.trace_output_dir=/var/www/AMRO xdebug.idekey="netbeans-xdebug" 
+1
source share

In the clean download and installation of netbeans working with xampp, xdebug worked, but did not stop at breakpoints. Changed php.ini: xdebug.remote_enable = 1 (from 0) and xdebug worked as expected!

0
source share

All Articles