Reputation: 115
I know this has been asked countless, as I've scoured the forums and read so many of these posts. However, it appears that the failures here are based on so many variables that the solutions are rather particular to the problem, and nothing is really remedying my problem here. I feel I need some guidance from you all more experienced players.
In NetBeans:
With my local sandbox project loaded, I click Debug Project, the index.php page opens in Chrome, the code runs all the way to the end regardless of breakpoints, and NetBeans hangs saying "Waiting For Connection (xdebug)"...
During the above, I can see:
aaron@aaron-aspire-v5:/var/log/apache2$ netstat -an | grep 9001
tcp6 0 0 :::9001 :::* LISTEN
In Vim:
://localhost/html/sandbox/index.php?XDEBUG_SESSION_START=netbeans-xdebug
in Chromewaiting for a new connection on port 9001 for 10 seconds...
so far so good.The connection times out in vim
During the above, prior to the timeout, I can see this:
aaron@aaron-aspire-v5:/var/log/apache2$ netstat -an | grep 9001
tcp 0 0 0.0.0.0:9001 0.0.0.0:* LISTEN
I've edited both the /etc/php5/cli/php.ini and /etc/php5/apache2/php.ini files and added the following:
zend_extension=/usr/lib/php5/20121212/xdebug.so xdebug.default_enable=1 xdebug.remote_enable=1 xdebug.remote_handler=dbgp xdebug.remote_mode=rep xdebug.remote_host=localhost xdebug.remote_port=9001 xdebug.remote_log=/var/log/apache2/xdebug.log
phpinfo() now returns the following regarding xdebug:
xdebug
xdebug support => enabled
Version => 2.2.5
IDE Key => aaron
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.idekey => no value => no value
xdebug.max_nesting_level => 100 => 100
xdebug.overload_var_dump => On => On
xdebug.profiler_aggregate => Off => Off
xdebug.profiler_append => Off => Off
xdebug.profiler_enable => Off => Off
xdebug.profiler_enable_trigger => Off => Off
xdebug.profiler_output_dir => /tmp => /tmp
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 => /var/log/apache2/xdebug.log => /var/log/apache2/xdebug.log
xdebug.remote_mode => rep => rep
xdebug.remote_port => 9001 => 9001
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_format => 0 => 0
xdebug.trace_options => 0 => 0
xdebug.trace_output_dir => /tmp => /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
let g:debuggerPort = 9001
has been added to my .vimrc file, and php_value xdebug.remote_port 9001
has been added to my apache2.conf file.Any help is greatly appreciated!! Thank you in advance.
Upvotes: 0
Views: 1309
Reputation: 11968
You did not set your xdebug.idekey => no value
xdebug.idekey => no value => no value
also
xdebug.remote_autostart => Off => O
is wrong.
Set it to
; idekey can be just about anything, but the value in php.ini needs
; to match the value used in the environment that launches php.
xdebug.idekey=vim_session
and
; We have to turn on remote_autostart when running php from
; cli. That's probably a good reason to keep the cli and apache
; versions of php.ini distinct.
xdebug.remote_autostart=1
You should see a message like waiting for a new connection on port 9000 for 5 seconds…
at the bottom of the screen.
You have five seconds to now refresh the PHP page.
This will create a connection between the debugger and client. Now you’re debugging. Follow the instructions in the Help window to step into, over and out of code. Press F5 to run the code until a breakpoint (which you can set using : BP )
also look at this answer PHP debugger for Vim
Update
Let phpinfo run again and see if the values I have mentioned are correct now? Then look also what other php config files still in use and look at the content.
Getting the server to connect on a different port is a little trickier. You need to set a custom php.ini value (xdebug.remote_port) for each user. It works best if you’re using VirtualHost’s in Apache. Just add the following line to the VirtualHost section of your httpd.conf:
php_value xdebug.remote_port 9001
Now restart Apache and if you use that VirtualHost and that vi user, then they should connect successfully.
Upvotes: 0