11

Celebrating setting up a new test server box in the usual way - by asking for help getting xdebug to work.

Server: Ubuntu Server 16.10 / Nginx / PHP 7 Xdebug setup with requirements as at http://php-built.com/installing-xdebug-for-php7/ and showing on phpinfo

i**:

These are the current settings tried

[xdebug]
zend_extension="/usr/lib/php/20151012/xdebug.so"
xdebug.remote_enable=true
xdebug.remote_host=192.168.0.201
xdebug.remote_port=10000 (port #9000 is usually occupied by FPM, so I recommend to use a differen$
xdebug.remote_autostart=1
xdebug.idekey=netbeans-xdebug

Client: Windows 10 / Netbeans listening on port 10000

Log:

Log opened at 2017-03-15 17:23:49
I: Connecting to configured address/port: 192.168.0.201:10000.
I: Connected to client. :-)
-> <init xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" fileuri="file:///var/www/usr-datadimension/datadimension/sitefiles/public/index.php" language="PHP" xdebug:language_version="7.0.15-0ubuntu0.16.10.4" protocol_version="1.0" appid="19891" idekey="netbeans-xdebug"><engine version="2.5.1"><![CDATA[Xdebug]]></engine><author><![CDATA[Derick Rethans]]></author><url><![CDATA[http://xdebug.org]]></url><copyright><![CDATA[Copyright (c) 2002-2017 by Derick Rethans]]></copyright></init>

<- feature_set -i 28 -n show_hidden -v 1
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="feature_set" transaction_id="28" feature="show_hidden" success="1"></response>

<- feature_set -i 29 -n max_depth -v 3
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="feature_set" transaction_id="29" feature="max_depth" success="1"></response>

<- feature_set -i 30 -n max_children -v 30
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="feature_set" transaction_id="30" feature="max_children" success="1"></response>

<- feature_set -i 31 -n max_data -v 2048
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="feature_set" transaction_id="31" feature="max_data" success="1"></response>

<- breakpoint_set -i 32 -t line -s enabled -f file://TESTSERVERSHARE/sitefiles/app/ControllerLibrary/Controllers/RootController_c.php -n 31
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="breakpoint_set" transaction_id="32" state="enabled" id="198910001"></response>

<- run -i 34
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="run" transaction_id="34" status="stopping" reason="ok"></response>

Log closed at 2017-03-15 17:23:50

I have edited this according to some helpful comments below but they have not provided the solution though I can see xdebug stating there is a connection in the logs.

Interestingly when I select 'stop at first line' the 'Continue' icon shows green and execution appears to stop, though I have no idea where. Breakpoints are still ignored so it appears Netbeans is identifying xdebug partly. This is using both the Chrome and Firefox.

Help required please for getting xdebug and netbeans to talk.

Datadimension
  • 872
  • 1
  • 12
  • 31
  • 1) Firewall? 2) Does NetBeans actually listen on TCP 9000 port (maybe you forgot to enable listener (e.g. in PhpStorm there are dedicated button just for that))? Check it with netstat or similar tool. 3) What are the full xdebug settings from php.ini? Log shows *"Checking remote connect back address"* ... but I do not see the corresponding config line (which means -- you are showing only part of it). 4) What it is IP -- `192.168.5.17` -- double check that it's a correct IP (must be an IP of a computer where NetBeans is running as seen from that Ubuntu) – LazyOne Mar 08 '17 at 09:38
  • @LazyOne - yup tried all the obvious. The IP is simply a local one with 192.168.5 range. IDE is shown as listening here. – Datadimension Mar 09 '17 at 23:05
  • do your server and your system on same network ? you are using public ip here. so please double check with those. and form cross check, can you access 192.168.0.201:10000 via you system? – chudasamachirag Mar 20 '17 at 08:40
  • @chudasamachirag where are you reading the public IP - these are addresses on the same LAN ? – Datadimension Mar 20 '17 at 08:46
  • as i know 192.168.{0-9}.{0-9} are suggesting local network, i used to do that – chudasamachirag Mar 20 '17 at 09:15

3 Answers3

1

I've never had to set this on Netbeans before but from looking at similar reported issues on Eclipse it appears that this setup requires Project properties > Source > Web Root to be set to the public directory served by Nginx. The breakpoints are now working properly.

Datadimension
  • 872
  • 1
  • 12
  • 31
0

I am using browser plugin: the-easiest-xdebug, it is also for chrome browsers (https://addons.mozilla.org/En-us/firefox/addon/the-easiest-xdebug/)

It has documentation on how to start xdebug

I successfully got it working on Netbeans, Atom.io, Ms Code. it's pretty easy.

Ananth
  • 108
  • 6
  • This looks promising, sorry I have not had a chance to test this but will do – Datadimension Mar 09 '17 at 23:02
  • Once you get started, then it's easy to setup xdebug on any platform or IDE – Ananth Mar 10 '17 at 02:49
  • In Visual Studio Code, there is a setting for the location of root dir for the server side, I guess that way IDE knows how to map urls to files, maybe something like that is your problem. Just looks like something like that, since it managed to connect to client, but not responding to breakpoints – Milan Markovic Mar 13 '17 at 12:45
0

Can you add those settings to ini and try out?

xdebug.remote_connect_back=1
xdebug.collect_includes=on
xdebug.extended_info=1
xdebug.show_local_vars=1
xdebug.show_mem_delta=1
xdebug.max_nesting_level=200

hope port 10000 is allowed

User123456
  • 2,492
  • 3
  • 30
  • 44