[ 
https://issues.apache.org/jira/browse/NETBEANS-5905?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17395245#comment-17395245
 ] 

Heinz Schweitzer commented on NETBEANS-5905:
--------------------------------------------

This is confusing:P

 

*The code to debug, any code will do*
{code:php}
<?php
class getOptions {
    public $default = [];
    function __construct() {
        $in = getopt("i:", ["adress:", "logfile:", "console:"]); //<== SET 
BREAKPOINT HERE
        if (isset($in['i'])) {
            $ini = parse_ini_file($in['i'], false, INI_SCANNER_TYPED);
        } else {
            $ini = false;
        }

        if ($ini === false) {
            openlog('websock', LOG_PID, LOG_USER);
            syslog(LOG_ERR, "no ini file found or not specified");
            closelog();
            exit;
        }
        $this->default = $this->overwrite($ini, $in);
    }
    private function overwrite($default, $param) {
        foreach ($param as $key => $value) {
            if (isset($default[$key])) {
                $default[$key] = $value;
            }
        }
        return $default;
    }
}
$x = new getOptions();
{code}
*Settings for Xdebug in php.ini*

xdebug.mode='debug, develop'
 xdebug.idekey="netbeans-xdebug"
 xdebug.remote_enable=on
 xdebug.remote_handler=dbgp
 xdebug.client_host=localhost
 xdebug.remote_host=localhost
 xdebug.remote_port=9003
 xdebug.log=D:/temp/xdebug.log

*Settings in Netbeans*

Debugger Port:9003
Session ID: netbeans-xdebug

 

*In a windows command shell do according to the Xdebug documentation*

>set *XDEBUG_SESSION=1*
 >php getOptions.php
 Xdebug: [Step Debug] Time-out connecting to debugging client, waited: 200 ms. 
Tried: localhost:9003 (through xdebug.client_host/xdebug.client_port) :(

*Nothing happens because Xdebug is not started. Just start Xdebug on any other 
project* *then try again*

>php getOptions.php

This is the entry in teh xdebug log file.

[276] [Step Debug] -> <init xmlns="urn:debugger_protocol_v1" 
xmlns:xdebug="https://xdebug.org/dbgp/xdebug"; 
fileuri="file:///F:/xampp-htdocs/phpWebSocketServer/ignore/getOptions.php" 
language="PHP" xdebug:language_version="8.0.4RC1" protocol_version="1.0" 
appid="276" *idekey="1"* ><engine 
version="3.0.4"><![CDATA[Xdebug]]></engine><author><![CDATA[Derick 
Rethans]]></author><url><![CDATA[https://xdebug.org]]></url><copyright><![CDATA[Copyright
 (c) 2002-2021 by Derick Rethans]]></copyright></init>

 

*Above script hangs. Kill it with CTRL-C . In the command shell do*

>set *XDEBUG_SESSION=netbeans-xdebug*

*Stop debuger in Netbeans then start it again. do:*

>php getOptions.php

*Now Netbeans shows the code an stops at the breakpoint.*

*The entry in the logfile is now*

[9632] [Step Debug] -> <init xmlns="urn:debugger_protocol_v1" 
xmlns:xdebug="https://xdebug.org/dbgp/xdebug"; 
fileuri="file:///F:/xampp-htdocs/phpWebSocketServer/ignore/getOptions.php" 
language="PHP" xdebug:language_version="8.0.4RC1" protocol_version="1.0" 
appid="9632" *idekey="netbeans-xdebug"* ><engine 
version="3.0.4"><![CDATA[Xdebug]]></engine><author><![CDATA[Derick 
Rethans]]></author><url><![CDATA[https://xdebug.org]]></url><copyright><![CDATA[Copyright
 (c) 2002-2021 by Derick Rethans]]></copyright></init>

> step debug from commandline
> ---------------------------
>
>                 Key: NETBEANS-5905
>                 URL: https://issues.apache.org/jira/browse/NETBEANS-5905
>             Project: NetBeans
>          Issue Type: Bug
>          Components: php - Debugger
>    Affects Versions: 12.3
>            Reporter: Heinz Schweitzer
>            Priority: Major
>
> This is not an Xdebug issue. Netbeans should not care about what the idekey 
> is,
> in order to decide whether to do anything with an incoming debugging session.
> Please file an issue with Netbeans:
> Filed a defect against Xdebug,  [https://bugs.xdebug.org/view.php?id=2005] 
> but the above was the responds from there. Below you will find my input.
> I am using step debugging via Netbeans with no problems at all , but following
> the documentation for doing so on the command line I found out that the
> recommended setting for 
> set XDEBUG_SESSION=1
> will not work.  Doing so, the log file for Xdebug shows me this line :
> [276] [Step Debug] -> <init xmlns="urn:debugger_protocol_v1"
> xmlns:xdebug=
> ["https://xdebug.org/dbgp/xdebug";|https://xdebug.org/dbgp/xdebug]
> fileuri=
> ["file:///F:/xampp-htdocs/phpWebSocketServer/ignore/getOptions.php"|file:///F:/xampp-htdocs/phpWebSocketServer/ignore/getOptions.php]
> language="PHP" xdebug:language_version="8.0.4RC1" protocol_version="1.0"
> appid="276" idekey="1"><engine
> version="3.0.4"><![CDATA[Xdebug]]></engine><author><![CDATA[Derick
> Rethans]]></author><url><![CDATA[
> [https://xdebug.org|https://xdebug.org/]
> ]]></url><copyright><![CDATA[Copyright
> (c) 2002-2021 by Derick Rethans]]></copyright></init>
> Here the idekey equals the value of XDEBUG_SESSION, therefore there is no
> reaction in Netbeans where I set my breakpoints. The PHP  script just hangs.
> Setting XDEBUG_SESSION=netbeans-xdebug  will make things work, when Xdebug is
> already started via Netbeans.  I  could not manage to get Xdebug started from
> the command line. The record from the log file looks now like:
> [11056] [Step Debug] -> <init xmlns="urn:debugger_protocol_v1"
> xmlns:xdebug=
> ["https://xdebug.org/dbgp/xdebug";|https://xdebug.org/dbgp/xdebug]
> fileuri=
> ["file:///F:/xampp-htdocs/phpWebSocketServer/ignore/getOptions.php"|file:///F:/xampp-htdocs/phpWebSocketServer/ignore/getOptions.php]
> language="PHP" xdebug:language_version="8.0.4RC1" protocol_version="1.0"
> appid="11056" idekey="netbeans-xdebug"><engine
> version="3.0.4"><![CDATA[Xdebug]]></engine><author><![CDATA[Derick
> Rethans]]></author><url><![CDATA[
> [https://xdebug.org|https://xdebug.org/]
> ]]></url><copyright><![CDATA[Copyright
> (c) 2002-2021 by Derick Rethans]]></copyright></init>
> Am I missing something ?



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists

Reply via email to