title: Visual Studio Code - Xdebug won't work
body: <p>In Visual Studio Code (1.9.1) (mac) i have setup the <em>php-debug</em> plugin.  </p>
  
  <p>In the debug screen i start '<em>listen for Xdebug</em>'.<br>
  After this i open the index.php on my XAMPP server (local).<br>
  But nothing happens.</p>
  
  <ul>
  <li>the blue bar at the bottom of the screen turns orange.  </li>
  <li>the step over, step into and step out buttons are greyed out.   </li>
  <li>Also the following error message occurs at the watched variables:<br>
  <strong>cannot evaluate code without an connection</strong></li>
  </ul>
  
  <p>I try to use breakpoints on the following code:</p>
  
  <pre><code>&lt;?php
  $i = 0;
  
  do {
  $i++;
  if (!($i % 1)) {
      echo('&lt;p&gt;$i = ' . $i . '&lt;/p&gt;');
      }
  }
  while ($i &lt; 100);
  ?&gt;
  </code></pre>
  
  <p>I am using XAMPP and in my <strong>php.ini</strong> file i use port 9000 for Xdebug.</p>
  
  <pre><code>zend_extension="/usr/local/Cellar/php71-xdebug/2.5.0/xdebug.so"
  xdebug.remote_enable = 1
  xdebug.remote_autostart = 1
  xdebug.remote.port=9000
  </code></pre>
  
  <p>I installed Xdebug using homebrew.<br>
  Here is my php info:
  <a href="http://trapce.net16.net/phpinfo.htm" rel="nofollow noreferrer">phpinfo.htm</a><br>
  <a href="https://xdebug.org/wizard.php" rel="nofollow noreferrer">Xdebug wizard</a> tells me Xdebug is installed correctly.</p>
  
  <p>my <strong>launch.json</strong> file looks like this:  </p>
  
  <pre><code>{
  "version": "0.2.0",
  "configurations": [
      {
          "name": "Listen for XDebug",
          "type": "php",
          "request": "launch",
          "port": 9000,
          "log": true
      },
      {
          "name": "Launch currently open script",
          "type": "php",
          "request": "launch",
          "program": "${file}",
          "cwd": "${fileDirname}",
          "port": 9000
      }
  ]
  }
  </code></pre>
  
  <p>Would anyone know what i am doing wrong?</p>
  
  <p>After setting the <code>xdebug.remote_connect_back = 1</code> in the ini file<br>
  as n00dl3 suggested debugging most of the time works, but once in a while i get the following<br>
  error in the debug console:</p>
  
  <pre><code>&lt;- threadEvent
  ThreadEvent {
    seq: 0,
    type: 'event',
    event: 'thread',
    body: { reason: 'exited', threadId: 1 } }
  </code></pre>