相关文章推荐
Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams

Xdebug with PhpStorm IDE - detects incoming connection but will not bring up debug console

Ask Question

I have tried to set up Xdebug (2.2.3) with PhpStorm 7.0 and I cannot bring up the step-through debugging console as I have in the past. The guides that I have used to set this up are:

  • https://www.jetbrains.com/phpstorm/webhelp/configuring-xdebug.html
  • http://blog.jetbrains.com/webide/2011/02/zero-configuration-debugging-with-xdebug-and-phpstorm-2-0/
  • I know that the Xdebug extension itself is working as the cachegrind.out.3280 files are being created on page load (with 12Mb litany of all of the scripts required and variables/values). My set up in php.ini (php version 5.4.12) is:

    zend_extension="c:/wamp/bin/php/php5.4.12/zend_ext/php_xdebug-2.2.3-5.4-vc9-x86_64.dll"
    xdebug.profiler_output_dir="c:/wamp/tmp"
    xdebug.profiler_output_name="cachegrind.out.%p"
    xdebug.profiler_enable=1
    xdebug.remote_enable=1
    xdebug.remote_port=9000
    xdebug.idekey=xdebug
    xdebug.remote_connect_back=1
    xdebug.remote_host=dashboard.dev
    

    After setting a break point, turning on Xdebug chrome extension, clicking to listen to Xdebug within PhpStorm and refreshing, I get the Incoming Connection from Xdebug dialogue:

    However, when I click Accept, the dialogue disappears and nothing happens.

    If I then go to Settings / PHP / Servers in PhpStorm, I see that a new entry has been created:

    Only by deleting the entry that was added can I get the Incoming Connection dialogue to show up again when I refresh the page. I notice that the port is set to 80 so wondering if that is right since the Xdebug extension is set to run over port 9000; when I click "Validate remote environment" select deployment server, then "Validate", I get: No debug extension is loaded. So I am assuming that the problem is something related to how this is set up.

    1) xdebug port (9000) and website port (80) are two DIFFERENT things. You should learn some basics first: xdebug.org/docs 2) xdebug.remote_host=dashboard.dev that's actually wrong -- it should be your IP address / domain name, not your website domain. it works only because it points to the same IP as your computer (127.0.0.1). 3) "Only by deleting the entry that was added can I get the Incoming Connection dialogue to show up again" -- that's correct and works exactly as it should. – LazyOne Nov 11, 2013 at 12:09 Now: 1) what is your PHP (not version number) -- is it 32 bit or 64 ? 2) Please show output of your phpinfo(); when executed via web interface (in a browser). Af far as I see it so far -- it should work for you OK -- I mean, it picks up incoming debug request. So .. what's happening after -- does it breaks on breakpoint? What will happen if you put xdebug_break(); in your code (programmatic breakpoint) ? – LazyOne Nov 11, 2013 at 12:14 Nice pointers - my php is 32bit (PHP_INT_SIZE = 4) and, to my surprise, xdebug_break() gets the debugger console to work (but the red circle breakpoints do not). – Joseph Cape Nov 11, 2013 at 12:20 1) Please show a screenshot with breakpoints -- maybe you have set them on a line where xdebug is unable to break (due to a bug or (most likely) the way how PHP itself generates bytecode); 2) "php_xdebug-2.2.3-5.4-vc9-x86_64.dll" -- this tells me that you are using 64-bit xdebug on 32-bit PHP -- it should not work, at all. Double check header table of phpinfo() output -- it should tell what Architecture your PHP is. – LazyOne Nov 11, 2013 at 12:25 okay, well the Architecture is x64 so 64 bit ... I had used the accepted response to stackoverflow.com/questions/6303241/… which suggested that PHP_INT_SIZE = 4 indicates 32 bit but not necessarily reliable I suppose. – Joseph Cape Nov 11, 2013 at 12:35

    The problem was fixed by adding the break points to other parts of the code as it was not working when attached to the try clause. Additionally, here are some other tips that might be useful:

  • Try using a programmatic breakpoint: xdebug_break();
  • Check that if your php is 32bit then so is the version of Xdebug (or that they are both 64 bit).
  • The xdebug remote host setting relates to the server IP address (so 127.0.0.1 for local).
  • "The xdebug remote host setting relates to the server IP address (so 127.0.0.1 for local)." - What do you mean by this? I always thought we needed to put the ip of the connecting client here? – Stephane Gosselin Oct 29, 2014 at 12:54

    In your Phpstorm goto File > Settings > Languages & Frameworks > PHP > Debug.

    Under External conections section, mark the checkbox saying

    Ignore external connections through unregistered server configurations

    This was fixed for me.

    Thanks for contributing an answer to Stack Overflow!

    • Please be sure to answer the question. Provide details and share your research!

    But avoid

    • Asking for help, clarification, or responding to other answers.
    • Making statements based on opinion; back them up with references or personal experience.

    To learn more, see our tips on writing great answers.

     
    推荐文章