title: Debug Symfony2 with XDebug and PHPStorm
body: <p>I try and try, but I can't get a proper debug configuration for Symfony2 with XDebug in PHPStorm.</p>
  
  <p>I've already checked and rechecked </p>
  
  <ul>
  <li><p><a href="https://stackoverflow.com/questions/29671347/phpstorm-xdebug-with-a-symfony2-project">phpstorm xdebug with a symfony2 project</a> and </p></li>
  <li><p><a href="https://stackoverflow.com/questions/18517083/how-to-set-up-remote-debugging-for-symfony2-with-phpstorm-and-xdebug">How to set up remote debugging for symfony2 with phpstorm and xdebug</a></p></li>
  </ul>
  
  <p>and followed the jetbrains tutorials, but no way to make this work.</p>
  
  <p>It's an rest api with Symfony2 what I am trying to debug. So far I have a Virtual Host with Apache2 which works fine in the URL </p>
  
  <pre><code>host: sd.lo
  </code></pre>
  
  <p>The routing prefix for the api is </p>
  
  <pre><code>/api/v1
  </code></pre>
  
  <p>so accessing</p>
  
  <pre><code>http://sd.lo/api/v1/clients
  </code></pre>
  
  <p>works fine and I receive a list of clients</p>
  
  <p><strong>Installation</strong></p>
  
  <p>XDebug is installed correctly as shown in my phpinfo() and with the command</p>
  
  <p>In my /usr/local/etc/php/5.5/conf.d/ext-xdebug.ini (which is correctly being loaded) i have:</p>
  
  <pre><code>[xdebug]
  zend_extension="/usr/local/Cellar/php55-xdebug/2.3.3/xdebug.so"
  xdebug.profiler_output_dir="/tmp/xdebug/"
  xdebug.profiler_enable=on
  xdebug.remote_enable=on
  xdebug.remote_host="localhost"
  xdebug.remote_port=9000
  xdebug.remote_handler="dbgp"
  xdebug.idekey = PHPSTORM
  </code></pre>
  
  <p>And with the command</p>
  
  <pre><code>/usr/local/Cellar/php55/5.5.28/bin/php -v
  
  PHP 5.5.28 (cli) (built: Aug 13 2015 14:02:41) 
  Copyright (c) 1997-2015 The PHP Group
  Zend Engine v2.5.0, Copyright (c) 1998-2015 Zend Technologies
      with Xdebug v2.3.3, Copyright (c) 2002-2015, by Derick Rethans
  </code></pre>
  
  <p><strong>In PHPStorm</strong></p>
  
  <p>I've set the PHP interpreter correctly in PHPStorm (I'm in OSX with multiple PHP versions installed. Brew installation is the one I want to use) so:</p>
  
  <pre><code>Path executable: /usr/local/Cellar/php55/5.5.28/bin/php
  Debugger: XDebug 2.3.3 so is correct
  </code></pre>
  
  <p>In PHPStorm Preferences > PHP > Servers I have a server</p>
  
  <pre><code>Name: Project.com
  Host: sd.lo (root for my Virtual Host)
  Port: 80
  Debugger: XDebug
  Use path mappings: UNCHECKED as I believe Symfony2 Plugin makes this for me
  </code></pre>
  
  <p>In Debug configurations I added a PHP Remote Debug</p>
  
  <pre><code>Name: ApiBundle
  Server: Project.com (which host was sd.lo)
  Ide Key: PHPSTORM
  </code></pre>
  
  <p><strong>In Chrome</strong> </p>
  
  <ul>
  <li>I've installed the XDebug Helper extension and selected PHPStorm in IDE Key</li>
  <li>Inspecting cookies I see the cookie XDEBUG_SESSION=PHPSTORM</li>
  </ul>
  
  <p><strong>And then</strong></p>
  
  <ul>
  <li>I've set a couple of breakpoints in one of my controllers</li>
  <li>I toggle the phone icon in PHPStorm to: Start Listening for PHP Debug Connections</li>
  <li>I check I have in my debug tab: Waiting for incoming connections with ide key: PHPSTORM</li>
  </ul>
  
  <p>Could be:</p>
  
  <ul>
  <li><p>that I have xdebug.remote_host="localhost" while I'm using Virtual hosts?</p></li>
  <li><p>that my PHP server points to a bad URL?</p></li>
  <li><p>that I need to configure the mapping? How I do this for Symfony?</p></li>
  </ul>
  
  <p>If I set Run > Break at first line in PHP scripts and reload the page, the script actually stops in app_dev.php:13 but nothing happens with my breakpoints.</p>
  
  <p>Anyone can iluminate me?</p>
  
  <p><strong>Edit</strong></p>
  
  <p>Here is my phpinfo() for xdebug</p>
  
  <pre><code>xdebug support  enabled
  Version 2.3.3
  IDE Key PHPSTORM
  
  Supported protocols Revision
  DBGp - Common DeBuGger Protocol $Revision: 1.145 $
  
  Directive   Local Value Master Value
  xdebug.auto_trace   Off Off
  xdebug.cli_color    0   0
  xdebug.collect_assignments  Off Off
  xdebug.collect_includes On  On
  xdebug.collect_params   0   0
  xdebug.collect_return   Off Off
  xdebug.collect_vars Off Off
  xdebug.coverage_enable  On  On
  xdebug.default_enable   On  On
  xdebug.dump.COOKIE  no value    no value
  xdebug.dump.ENV no value    no value
  xdebug.dump.FILES   no value    no value
  xdebug.dump.GET no value    no value
  xdebug.dump.POST    no value    no value
  xdebug.dump.REQUEST no value    no value
  xdebug.dump.SERVER  no value    no value
  xdebug.dump.SESSION no value    no value
  xdebug.dump_globals On  On
  xdebug.dump_once    On  On
  xdebug.dump_undefined   Off Off
  xdebug.extended_info    On  On
  xdebug.file_link_format no value    no value
  xdebug.force_display_errors Off Off
  xdebug.force_error_reporting    0   0
  xdebug.halt_level   0   0
  xdebug.idekey   PHPSTORM    PHPSTORM
  xdebug.max_nesting_level    256 256
  xdebug.max_stack_frames -1  -1
  xdebug.overload_var_dump    On  On
  xdebug.profiler_aggregate   Off Off
  xdebug.profiler_append  Off Off
  xdebug.profiler_enable  On  On
  xdebug.profiler_enable_trigger  Off Off
  xdebug.profiler_enable_trigger_value    no value    no value
  xdebug.profiler_output_dir  /tmp/xdebug/    /tmp/xdebug/
  xdebug.profiler_output_name cachegrind.out.%p   cachegrind.out.%p
  xdebug.remote_autostart Off Off
  xdebug.remote_connect_back  Off Off
  xdebug.remote_cookie_expire_time    3600    3600
  xdebug.remote_enable    On  On
  xdebug.remote_handler   dbgp    dbgp
  xdebug.remote_host  localhost   localhost
  xdebug.remote_log   no value    no value
  xdebug.remote_mode  req req
  xdebug.remote_port  9000    9000
  xdebug.scream   Off Off
  xdebug.show_exception_trace Off Off
  xdebug.show_local_vars  Off Off
  xdebug.show_mem_delta   Off Off
  xdebug.trace_enable_trigger Off Off
  xdebug.trace_enable_trigger_value   no value    no value
  xdebug.trace_format 0   0
  xdebug.trace_options    0   0
  xdebug.trace_output_dir /var/tmp/   /var/tmp/
  xdebug.trace_output_name    trace.%c    trace.%c
  xdebug.var_display_max_children 128 128
  xdebug.var_display_max_data 512 512
  xdebug.var_display_max_depth    3   3
  </code></pre>
  
  <p>But no /tmp/xdebug file was created :S</p>