Skip to main content

So eclipse and xdebug walk into a bar, and then my apache server dies


I am using windows xp x86, wamp, apache2, php 5.3 x86, eclipse php, and xdebug, running on localhost as both a virtualhost and an https virtualhost



eclipse version info

Eclipse for PHP Developers Version: Helios Release Build id: 20100617-1415



I had successfully managed, somehow, to setup eclipse and xdebug and all was well.



Then I had to make an svn branch of my project, and reconfigure apache with 2 new virtual hosts, and update my windows host files.



Now when I launch debug mode in eclipse everything dies.



Specifically, If I set no breakpoints the app runs fine, save for the problem I'm trying to debug in the first place.



If I set a breakpoint, the app stops at the breakpoint, and eclipse appears to be holding the ball. But now, when I press continue, or step over, or step into, or sneeze, eclipse tells me execution has resumed, but the application continues to hang, and I have to restart apache.



I suspect that there is some break in the communication between eclipse and xdebug, because it looks to me like eclipse is sending my continue or step over command, but xdebug is not receiving it.



But even if that's the case I don't know what to do about it. Where should I be looking?



Update:

I have successfully been able to debug using notepad++, its xdebug plugin, and, like a caveman, typing &XDEBUG_SESSION_START=session_name into the url. However, despite my love for npp, its debug plugin is quite buggy...



So I noticed an ad on stackoverflow for something called "phpstorm", which professed to be a lightweight yet full featured php ide, with native xdebug support. The demo required a restart to get it to work, and it feels kind of like working on a wobbly draft table, but it managed to debug both my small test app and real app very nicely, which is more than I can say for eclipse at the moment, even though its probably my fault.



I probably should have posted this earlier :/ Here is my phpinfo() xdebug section




xdebug
xdebug support enabled
Version 2.1.0

Supported protocols Revision
DBGp - Common DeBuGger Protocol $Revision: 1.145 $

Directive Local Value Master Value
xdebug.auto_trace Off Off
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.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.manual_url http://www.php.net http://www.php.net
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 C:\xampp\tmp C:\xampp\tmp
xdebug.profiler_output_name xdebug_profile.%p xdebug_profile.%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 c:\xampp\apache\logs\xdebug.log c:\xampp\apache\logs\xdebug.log
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_format 0 0
xdebug.trace_options 0 0
xdebug.trace_output_dir C:\xampp\tmp C:\xampp\tmp
xdebug.trace_output_name trace.%c trace.%c
xdebug.var_displ

ay_max_children 128 128
xdebug.var_display_max_data 512 512
xdebug.var_display_max_depth 3 3



Here is an xdebug log file of when I reproduce the problem




Log opened at 2011-01-03 08:56:22 ->



<- feature_set -i 33 -n show_hidden -v 1 ->



<- feature_set -i 34 -n max_depth -v 3 ->



<- feature_set -i 35 -n max_children -v 31 ->



<- feature_get -i 36 -n encoding ->



<- feature_get -i 37 -n supports_async ->



<- stdout -i 38 -c 1 ->



<- stderr -i 39 -c 1 ->



<- breakpoint_set -i 40 -t line -f file:///C:%5Cxampp%5Chtdocs%5Clab%5Czf-tutorial%5Cpublic%5Cindex.php -n 21 ->



<- run -i 41 ->



<- stack_get -i 42 ->



<- stack_get -i 43 ->



<- eval -i 44 -- JHRoaXMtPmZpZWxkc1snYm9vbF9jb21wbGV0ZSdd ->



<- eval -i 45 -- JHRoaXMtPnN0YWdlLT5nZXQoJ2Jvb2xfY29tcGxldGUnKQ== ->



<- eval -i 46 -- JHRoaXMtPmZpZWxkc1snYm9vbF9jb21wbGV0ZSdd ->



<- eval -i 47 -- JHRoaXMtPnN0YWdlLT5nZXQoJ2Jvb2xfY29tcGxldGUnKQ== ->



=== breakpoint reached, execution pauses. In eclipse I click "step over"



<- step_over -i 48



=== end of log



Source: Tips4allCCNA FINAL EXAM

Comments

  1. This article sounds promising.

    Both XDebug and Eclipse (in its php dev env) can use the DBGp protocol by the look of things. Based on that article, you might be able to get things working by messing with Apache's .htaccess file[s], or by running a DBGp proxy (whatever that is). Further details in the article.

    I suspect both XDebug and Eclipse are connecting to the same PHP debug session, stepping on one anothers toes, causing Hilarity to Ensue.

    That or "undefined behavior". Either way.

    ReplyDelete
  2. wooooooooooooo

    https://bugs.eclipse.org/bugs/show_bug.cgi?id=312951#c8

    Creating a new workspace allows me to debug succesfully.

    Right now my best guess as to what caused this is having two projects in the same workspace with different vhosts at the same ip.

    So I aint not gonna do that no more.

    ReplyDelete
  3. This may sound like a silly question, and I apologize if so, but did you create a new PHP Server inside of your Eclipse Debug Configuration that maps to your new virtual host?

    Every time I create a new vhost, I usually create a totally new Debug Configuration and a new PHP Server within that configuration that maps to the vhost, so that I can easily select it from the Debug Configs drop down when launching a new session.

    For anyone wondering, I do this by going to Run->"Debug Configurations...", select "PHP Web Page" from the menu on the left, click new+ (or duplicate if I already have one), and then under the Server tab, where is says "PHP Server", I click "New" and then type in the URL of the vhost for the document root.

    ReplyDelete
  4. Right now my best guess as to what caused this is having two projects in the same workspace with different vhosts at the same ip.


    Well I am debugging as well two projects, in the the same Eclipse-workspace with different VHosts at the same IP and use apache.

    And I am not experiencing your problems.

    Though my apache and stuff is located in a vmware-emulation of debian and my Eclipse resides in WinXP.

    Best

    Raffael

    ReplyDelete

Post a Comment

Popular posts from this blog

[韓日関係] 首相含む大幅な内閣改造の可能性…早ければ来月10日ごろ=韓国

div not scrolling properly with slimScroll plugin

I am using the slimScroll plugin for jQuery by Piotr Rochala Which is a great plugin for nice scrollbars on most browsers but I am stuck because I am using it for a chat box and whenever the user appends new text to the boxit does scroll using the .scrollTop() method however the plugin's scrollbar doesnt scroll with it and when the user wants to look though the chat history it will start scrolling from near the top. I have made a quick demo of my situation http://jsfiddle.net/DY9CT/2/ Does anyone know how to solve this problem?

Why does this javascript based printing cause Safari to refresh the page?

The page I am working on has a javascript function executed to print parts of the page. For some reason, printing in Safari, causes the window to somehow update. I say somehow, because it does not really refresh as in reload the page, but rather it starts the "rendering" of the page from start, i.e. scroll to top, flash animations start from 0, and so forth. The effect is reproduced by this fiddle: http://jsfiddle.net/fYmnB/ Clicking the print button and finishing or cancelling a print in Safari causes the screen to "go white" for a sec, which in my real website manifests itself as something "like" a reload. While running print button with, let's say, Firefox, just opens and closes the print dialogue without affecting the fiddle page in any way. Is there something with my way of calling the browsers print method that causes this, or how can it be explained - and preferably, avoided? P.S.: On my real site the same occurs with Chrome. In the ex