Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Hi I'm using XDEBUG to debug my WordPress code, is it possible to view the page building up in the browser while debugging? At the moment the page just hangs until the debugging process is finished then displays the fully rendered page. Ideally I'd like to see the page building up bit by bit as I debug through the theme's code.

share|improve this question
    
Depending on your IDE, you should be able to just step into/over the code and your breakpoints, and the output will be sent to the browser at the normal times during script execution. You can also use your IDE to watch variables and see their values. –  Ian Dunn Feb 12 '13 at 18:19
add comment

2 Answers

up vote 0 down vote accepted

Just an Idea - I did not test this.

Worth a try would be to play around with your PHP settings:

; Implicit flush tells PHP to tell the output layer to flush itself      
; automatically after every output block. This is equivalent to calling the PHP   
; function flush() after each and every call to print() or echo() and each and 
; every HTML block. Turning this option on has serious performance implications 
; and is generally recommended for debugging purposes only. 
implicit_flush = On

I would also recommend to disable gzip and look for other output_buffering related options in php.ini.

Then you should be able to set break-points in the different rendering stages of your theme.

share|improve this answer
    
Thanks will try this. Judging by the lack of feedback on this question I understand that most developers do not do the kind of debugging I want to do. Most seem to be content with having the full page output at once. I think WordPress itself implements some caching which could complicate things. –  drtanz Jul 12 '12 at 23:49
    
I'm not a Wordpress Developer, but its not clear what you want to archive, do you want an idea when some code is executed? For this I'd use the xdebug profiler feature with kcachegrind, which gives you a nice call tree. For the flushing question, there could a lot of other factors play a role beside PHP itself, maybe the browser or a webserver. –  mt_ Jul 14 '12 at 12:52
    
As for caching, this should not matter as caching in Wordpress (without any 3rd-party plugins) is mostly a shortcut for time intensive queries and is only used punctual. It should not interfere with theme rendering or you should notice in the theme source-code. –  mt_ Jul 14 '12 at 12:54
add comment

You can also change the output_buffering parameter in php.ini file to zero(0).

output_buffering = 0
share|improve this answer
1  
"This answer was automatically flagged as low-quality because of its length and content", which I am sure you don't want. Can you provide a bit of an explanation of what this code does and why it might solve the problem. –  s_ha_dum May 3 '13 at 19:48
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.