I try and try, but I can't get a proper debug configuration for Symfony2 with XDebug in PHPStorm.
I've already checked and rechecked
phpstorm xdebug with a symfony2 project and
How to set up remote debugging for symfony2 with phpstorm and xdebug
and followed the jetbrains tutorials, but no way to make this work.
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
host: sd.lo
The routing prefix for the api is
/api/v1
so accessing
http://sd.lo/api/v1/clients
works fine and I receive a list of clients
Installation
XDebug is installed correctly as shown in my phpinfo() and with the command
In my /usr/local/etc/php/5.5/conf.d/ext-xdebug.ini (which is correctly being loaded) i have:
[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
And with the command
/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
In PHPStorm
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:
Path executable: /usr/local/Cellar/php55/5.5.28/bin/php
Debugger: XDebug 2.3.3 so is correct
In PHPStorm Preferences > PHP > Servers I have a server
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
In Debug configurations I added a PHP Remote Debug
Name: ApiBundle
Server: Project.com (which host was sd.lo)
Ide Key: PHPSTORM
In Chrome
- I've installed the XDebug Helper extension and selected PHPStorm in IDE Key
- Inspecting cookies I see the cookie XDEBUG_SESSION=PHPSTORM
And then
- I've set a couple of breakpoints in one of my controllers
- I toggle the phone icon in PHPStorm to: Start Listening for PHP Debug Connections
- I check I have in my debug tab: Waiting for incoming connections with ide key: PHPSTORM
Could be:
that I have xdebug.remote_host="localhost" while I'm using Virtual hosts?
that my PHP server points to a bad URL?
that I need to configure the mapping? How I do this for Symfony?
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.
Anyone can iluminate me?
Edit
Here is my phpinfo() for xdebug
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
But no /tmp/xdebug file was created :S