PHP remote debugging: XDebug can't connect to JetBrains php Storm client

前端 未结 3 1210
灰色年华
灰色年华 2020-12-15 19:21

i\'s like to get remote debugging to work with the following software configuration:

Win 7 Pro 64bit WAMP Server 2.2 (32bit) incl. Apache 2.2.22, PHP 5.4.3, XDebug p

相关标签:
3条回答
  • 2020-12-15 19:33

    Where exactly is your breakpoint in your code? I know that XDebug can be funny.

    For PHP 5.4, your Xdebug settings should be

    [XDebug]
    zend_extension="<path to php_xdebug.dll>"
    xdebug.remote_enable=1
    xdebug.remote_port="<the port for XDebug to listen to>" (the default port is 9000)
    xdebug.profiler_enable=1
    xdebug.profiler_output_dir="<AMP home\tmp>"
    

    http://www.jetbrains.com/phpstorm/webhelp/configuring-xdebug.html

    0 讨论(0)
  • 2020-12-15 19:34

    Maybe a bit late but...

    Here you have a contradiction on your settings:

    xdebug.remote_host="localhost"
    xdebug.remote_connect_back=On
    

    Those two settings overlap. What is your case?

    a) You want to debug your application just from one single origin (for example, you are developing from and deploying to localhost).

    Then you are almost done: you have already defined that the remote host is localhost. Comment out the remote_connect_back line (with ;)

    b) You want to accept multiple development sources (for example, several machines debugging the application in the same network).

    Then the remote_host line is being overriden, so you can remove or comment it.

    This is effectively the configuration you are currently running. So, what's wrong with it? Check it out running this script:

    <?
    echo $_SERVER['REMOTE_ADDR'];
    

    The output will be ::1. Well, the host which is making the request to your Apache server is localhost. And Apache is resolving that name as the IPv6 address ::1, which in the end is not wrong. But Xdebug is unable to connect to an IPv6 address. See:

    I: Remote address found, connecting to ::1:9000.
    E: Could not connect to client. :-(
    

    So our goal will be to make Apache to resolve localhost preferably to an IPv4 address (without disabling any support for IPv6 at OS level nor at Apache level). This may be achieved by adding to your hosts file the next line:

    127.0.0.1 localhost
    

    This simple hack will do the trick! Now localhost will always preferably be resolved as an IPv4 address, while ::1 will still be perfectly understandable.

    0 讨论(0)
  • 2020-12-15 19:39

    You can try to disable IPV6 http://support.microsoft.com/kb/929852, I think this is the problem, when you try to connect.

    Remote address found, connecting to ::1:9000.

    System are try to connect with IPV6 and I think that XDebug are only enable to IPV4.

    0 讨论(0)
提交回复
热议问题