Home » Language IDEs » PHP Development Tools (PDT) » Newbie Getting "print" output to browser during debug?
Newbie Getting "print" output to browser during debug? [message #70588] |
Wed, 14 May 2008 05:20 |
Eclipse User |
|
|
|
Originally posted by: spam1.makovec.net
Hi all,
Newbie question:
Using XDebug 2.0.3/PHP 5.2.6 here on OS X 10.5.
When debugging as a "PHP Web page" (as opposed to a "PHP Script"), is
there any way to get the script being debugged to generate its output
to the browser immediately? It appears to set some sort of output
buffering occurs.
Take the following piece of code:
<?php
header("content-type: text/html");
print "This is a test<br>\n";
$t = new testme();
$t->doit(2);
print "done<br>\n";
exit(0);
class testme {
public function __construct() {
print "Constructing<br>\n";
error_log("Constructor",0);
}
/**
* Great little function
*
* @param int $id - a lovely number
*/
public function doit($id) {
print "Doing it with id $id...<br>\n";
}
}
?>
If I set a breakpoint at the "public function doit($id) {" line and hit
Debug, the script appears to execute on the server (the results of the
error_log() are written to the log) up until the breakpoint.
However, none of the "print" calls appear to be getting executed until
I restart the process, click "Remote Launch" in the Debug view and then
the "Terminate" button - at which point all the output is displayed and
the process exits (at which point a second browser window opens for me
saying "DEBUG SESSION ENDED".
Is there any way I could configure PDT/XDebug to instruct PHP to output
the results of the print calls immediately, rather than waiting for the
debugging session to end?
Thanks in advance!
|
|
|
Re: Newbie Getting "print" output to browser during debug? [message #70796 is a reply to message #70588] |
Wed, 14 May 2008 08:37 |
D Kelsey Messages: 232 Registered: July 2009 |
Senior Member |
|
|
Hi Dan, xdebug 2.0.3 is not supported unfortunately. The author made a change in 2.0.3 which altered
the protocol and as such PDT 1.0.2 cannot work correctly with it. As you have experienced, the
debug session never terminates when the request ends. For PDT 1.0.2 you need to use Xdebug 2.0.2.
Support for Xdebug 2.0.3 wil be available in PDT 1.0.3 and PDT 1.1.
It looks like you can get xdebug 2.0.2 from the following link
http://www.xdebug.org/link.php?url=xdebug202-52-win
As for your other issue, you may want to take a look at flush() for more information.
http://www.php.net/flush
Dave Kelsey.
Dan wrote:
> Hi all,
>
> Newbie question:
>
> Using XDebug 2.0.3/PHP 5.2.6 here on OS X 10.5.
>
> When debugging as a "PHP Web page" (as opposed to a "PHP Script"), is
> there any way to get the script being debugged to generate its output to
> the browser immediately? It appears to set some sort of output
> buffering occurs.
>
> Take the following piece of code:
>
> <?php
> header("content-type: text/html");
> print "This is a test<br>\n";
>
> $t = new testme();
>
> $t->doit(2);
>
> print "done<br>\n";
> exit(0);
>
> class testme {
> public function __construct() {
> print "Constructing<br>\n";
> error_log("Constructor",0);
> }
>
> /**
> * Great little function
> *
> * @param int $id - a lovely number
> */
> public function doit($id) {
> print "Doing it with id $id...<br>\n";
> }
> }
> ?>
>
> If I set a breakpoint at the "public function doit($id) {" line and hit
> Debug, the script appears to execute on the server (the results of the
> error_log() are written to the log) up until the breakpoint.
>
> However, none of the "print" calls appear to be getting executed until I
> restart the process, click "Remote Launch" in the Debug view and then
> the "Terminate" button - at which point all the output is displayed and
> the process exits (at which point a second browser window opens for me
> saying "DEBUG SESSION ENDED".
>
> Is there any way I could configure PDT/XDebug to instruct PHP to output
> the results of the print calls immediately, rather than waiting for the
> debugging session to end?
>
> Thanks in advance!
>
|
|
|
Re: Newbie Getting "print" output to browser during debug? [message #70802 is a reply to message #70796] |
Wed, 14 May 2008 12:44 |
Eclipse User |
|
|
|
Originally posted by: spam1.makovec.net
Hi Dave,
Fantastic, thanks for the super quick response! I'll downgrade to
2.0.2 right away. I actually was running 2.0.2 and only upped to 2.0.3
when I saw it today on the site. So much for dot-dot releases
maintaining backward compatibility!
On 2008-05-14 18:37:18 +1000, Dave Kelsey <dkel50@hotmail.com> said:
> Hi Dan, xdebug 2.0.3 is not supported unfortunately. The author made a
> change in 2.0.3 which altered the protocol and as such PDT 1.0.2
> cannot work correctly with it. As you have experienced, the debug
> session never terminates when the request ends. For PDT 1.0.2 you need
> to use Xdebug 2.0.2. Support for Xdebug 2.0.3 wil be available in PDT
> 1.0.3 and PDT 1.1.
>
> It looks like you can get xdebug 2.0.2 from the following link
> http://www.xdebug.org/link.php?url=xdebug202-52-win
>
> As for your other issue, you may want to take a look at flush() for
> more information.
>
> http://www.php.net/flush
>
> Dave Kelsey.
>
>
> Dan wrote:
>> Hi all,
>>
>> Newbie question:
>>
>> Using XDebug 2.0.3/PHP 5.2.6 here on OS X 10.5.
>>
>> When debugging as a "PHP Web page" (as opposed to a "PHP Script"), is
>> there any way to get the script being debugged to generate its output
>> to the browser immediately? It appears to set some sort of output
>> buffering occurs.
>>
>> Take the following piece of code:
>>
>> <?php
>> header("content-type: text/html");
>> print "This is a test<br>\n";
>>
>> $t = new testme();
>>
>> $t->doit(2);
>>
>> print "done<br>\n";
>> exit(0);
>>
>> class testme {
>> public function __construct() {
>> print "Constructing<br>\n";
>> error_log("Constructor",0);
>> }
>> /**
>> * Great little function
>> *
>> * @param int $id - a lovely number
>> */
>> public function doit($id) {
>> print "Doing it with id $id...<br>\n";
>> }
>> }
>> ?>
>>
>> If I set a breakpoint at the "public function doit($id) {" line and hit
>> Debug, the script appears to execute on the server (the results of the
>> error_log() are written to the log) up until the breakpoint.
>>
>> However, none of the "print" calls appear to be getting executed until
>> I restart the process, click "Remote Launch" in the Debug view and then
>> the "Terminate" button - at which point all the output is displayed and
>> the process exits (at which point a second browser window opens for me
>> saying "DEBUG SESSION ENDED".
>>
>> Is there any way I could configure PDT/XDebug to instruct PHP to output
>> the results of the print calls immediately, rather than waiting for the
>> debugging session to end?
>>
>> Thanks in advance!
|
|
|
Re: Newbie Getting "print" output to browser during debug? [message #70811 is a reply to message #70802] |
Wed, 14 May 2008 15:04 |
D Kelsey Messages: 232 Registered: July 2009 |
Senior Member |
|
|
It would not be possible to maintain backward compatibility with the change that was made. It was an
area of the specification that wasn't clear if it had to be explicitly handled or not and as xdebug
prior to 2.0.3 didn't use it, I hadn't implemented code to handle it, so cant really blame Derick
for the problem.
PDT 1.0.3 should be able to handle xdebug 2.0.2 and 2.0.3 without any problems. I don't think the
support made it into 1.0.3rc1 through.
Dave Kelsey
Dan wrote:
> Hi Dave,
>
> Fantastic, thanks for the super quick response! I'll downgrade to 2.0.2
> right away. I actually was running 2.0.2 and only upped to 2.0.3 when I
> saw it today on the site. So much for dot-dot releases maintaining
> backward compatibility!
>
> On 2008-05-14 18:37:18 +1000, Dave Kelsey <dkel50@hotmail.com> said:
>
>> Hi Dan, xdebug 2.0.3 is not supported unfortunately. The author made a
>> change in 2.0.3 which altered the protocol and as such PDT 1.0.2
>> cannot work correctly with it. As you have experienced, the debug
>> session never terminates when the request ends. For PDT 1.0.2 you need
>> to use Xdebug 2.0.2. Support for Xdebug 2.0.3 wil be available in PDT
>> 1.0.3 and PDT 1.1.
>>
>> It looks like you can get xdebug 2.0.2 from the following link
>> http://www.xdebug.org/link.php?url=xdebug202-52-win
>>
>> As for your other issue, you may want to take a look at flush() for
>> more information.
>>
>> http://www.php.net/flush
>>
>> Dave Kelsey.
>>
>>
>> Dan wrote:
>>> Hi all,
>>>
>>> Newbie question:
>>>
>>> Using XDebug 2.0.3/PHP 5.2.6 here on OS X 10.5.
>>>
>>> When debugging as a "PHP Web page" (as opposed to a "PHP Script"), is
>>> there any way to get the script being debugged to generate its output
>>> to the browser immediately? It appears to set some sort of output
>>> buffering occurs.
>>>
>>> Take the following piece of code:
>>>
>>> <?php
>>> header("content-type: text/html");
>>> print "This is a test<br>\n";
>>>
>>> $t = new testme();
>>>
>>> $t->doit(2);
>>>
>>> print "done<br>\n";
>>> exit(0);
>>>
>>> class testme {
>>> public function __construct() {
>>> print "Constructing<br>\n";
>>> error_log("Constructor",0);
>>> }
>>> /**
>>> * Great little function
>>> *
>>> * @param int $id - a lovely number
>>> */
>>> public function doit($id) {
>>> print "Doing it with id $id...<br>\n";
>>> }
>>> }
>>> ?>
>>>
>>> If I set a breakpoint at the "public function doit($id) {" line and
>>> hit Debug, the script appears to execute on the server (the results
>>> of the error_log() are written to the log) up until the breakpoint.
>>>
>>> However, none of the "print" calls appear to be getting executed
>>> until I restart the process, click "Remote Launch" in the Debug view
>>> and then the "Terminate" button - at which point all the output is
>>> displayed and the process exits (at which point a second browser
>>> window opens for me saying "DEBUG SESSION ENDED".
>>>
>>> Is there any way I could configure PDT/XDebug to instruct PHP to
>>> output the results of the print calls immediately, rather than
>>> waiting for the debugging session to end?
>>>
>>> Thanks in advance!
>
>
|
|
|
Re: Newbie Getting "print" output to browser during debug? [message #70856 is a reply to message #70811] |
Thu, 15 May 2008 00:24 |
Eclipse User |
|
|
|
Originally posted by: spam1.makovec.net
Hi Dave,
I downgraded to XDebug 2.0.2 this morning. Running PDT
1.0.3.v20080429-79-7PE7QYGHNGqZW, as downloaded from Eclipse.org
yesterday. Killed and restarted Apache and Eclipse to ensure all
traces of xdebug 2.0.3 were gone.
I tried using the following script:
<?php
print "A<br>\n";
print "B<br>\n";
print "C<br>\n";
print "D<br>\n";
?>
I set a breakpoint at the print "C<br>\n"; line. Selecting "debug as
web page", I would expect to see the output:
A
B
then have the script suspend at line 4.
However, the browser window pops up empty (I've tried with both Firefox
and Safari), and the script is suspended at line 4. As soon as I click
"Resume", I get the full output:
A
B
C
D
Very weird! But it gets weirder.
I change the above script to:
<?php
phpinfo();
print "A<br>\n";
print "B<br>\n";
print "C<br>\n";
print "D<br>\n";
?>
and keep the breakpoint in the same place.
This time when I click "Debug", the phpinfo() output is displayed
immediately - up until about half way through the "Environment" table,
but neither of the two print calls display. Once again, the script is
suspended at my breakpoint, and clicking "Resume" completes the
phpinfo() output and outputs all my prints.
It sounds like there's some sort of output buffering going on, but I've
set output_buffering=0 in my php.ini
Any ideas?
On 2008-05-15 01:04:21 +1000, Dave Kelsey <dkel50@hotmail.com> said:
> It would not be possible to maintain backward compatibility with the
> change that was made. It was an area of the specification that wasn't
> clear if it had to be explicitly handled or not and as xdebug prior to
> 2.0.3 didn't use it, I hadn't implemented code to handle it, so cant
> really blame Derick for the problem.
> PDT 1.0.3 should be able to handle xdebug 2.0.2 and 2.0.3 without any
> problems. I don't think the support made it into 1.0.3rc1 through.
>
> Dave Kelsey
>
> Dan wrote:
>> Hi Dave,
>>
>> Fantastic, thanks for the super quick response! I'll downgrade to
>> 2.0.2 right away. I actually was running 2.0.2 and only upped to 2.0.3
>> when I saw it today on the site. So much for dot-dot releases
>> maintaining backward compatibility!
>>
>> On 2008-05-14 18:37:18 +1000, Dave Kelsey <dkel50@hotmail.com> said:
>>
>>> Hi Dan, xdebug 2.0.3 is not supported unfortunately. The author made a
>>> change in 2.0.3 which altered the protocol and as such PDT 1.0.2
>>> cannot work correctly with it. As you have experienced, the debug
>>> session never terminates when the request ends. For PDT 1.0.2 you need
>>> to use Xdebug 2.0.2. Support for Xdebug 2.0.3 wil be available in PDT
>>> 1.0.3 and PDT 1.1.
>>>
>>> It looks like you can get xdebug 2.0.2 from the following link
>>> http://www.xdebug.org/link.php?url=xdebug202-52-win
>>>
>>> As for your other issue, you may want to take a look at flush() for
>>> more information.
>>>
>>> http://www.php.net/flush
>>>
>>> Dave Kelsey.
>>>
>>>
>>> Dan wrote:
>>>> Hi all,
>>>>
>>>> Newbie question:
>>>>
>>>> Using XDebug 2.0.3/PHP 5.2.6 here on OS X 10.5.
>>>>
>>>> When debugging as a "PHP Web page" (as opposed to a "PHP Script"), is
>>>> there any way to get the script being debugged to generate its output
>>>> to the browser immediately? It appears to set some sort of output
>>>> buffering occurs.
>>>>
>>>> Take the following piece of code:
>>>>
>>>> <?php
>>>> header("content-type: text/html");
>>>> print "This is a test<br>\n";
>>>>
>>>> $t = new testme();
>>>>
>>>> $t->doit(2);
>>>>
>>>> print "done<br>\n";
>>>> exit(0);
>>>>
>>>> class testme {
>>>> public function __construct() {
>>>> print "Constructing<br>\n";
>>>> error_log("Constructor",0);
>>>> }
>>>> /**
>>>> * Great little function
>>>> *
>>>> * @param int $id - a lovely number
>>>> */
>>>> public function doit($id) {
>>>> print "Doing it with id $id...<br>\n";
>>>> }
>>>> }
>>>> ?>
>>>>
>>>> If I set a breakpoint at the "public function doit($id) {" line and hit
>>>> Debug, the script appears to execute on the server (the results of the
>>>> error_log() are written to the log) up until the breakpoint.
>>>>
>>>> However, none of the "print" calls appear to be getting executed until
>>>> I restart the process, click "Remote Launch" in the Debug view and then
>>>> the "Terminate" button - at which point all the output is displayed and
>>>> the process exits (at which point a second browser window opens for me
>>>> saying "DEBUG SESSION ENDED".
>>>>
>>>> Is there any way I could configure PDT/XDebug to instruct PHP to output
>>>> the results of the print calls immediately, rather than waiting for the
>>>> debugging session to end?
>>>>
>>>> Thanks in advance!
|
|
|
Re: Newbie Getting "print" output to browser during debug? [message #70893 is a reply to message #70856] |
Thu, 15 May 2008 00:32 |
Eclipse User |
|
|
|
Originally posted by: spam1.makovec.net
Aha! Found the culprit.
When I installed PHP, I used the supplied php.ini-recommended as the
basis for my configuration. This includes the non-default directive:
implicit_flush = Off
Changing this to On fixed the problem!
Thanks for your help Dave!
On 2008-05-15 10:24:25 +1000, Dan <spam1@makovec.net> said:
> Hi Dave,
>
> I downgraded to XDebug 2.0.2 this morning. Running PDT
> 1.0.3.v20080429-79-7PE7QYGHNGqZW, as downloaded from Eclipse.org
> yesterday. Killed and restarted Apache and Eclipse to ensure all
> traces of xdebug 2.0.3 were gone.
>
> I tried using the following script:
> <?php
> print "A<br>\n";
> print "B<br>\n";
> print "C<br>\n";
> print "D<br>\n";
>
> ?>
>
> I set a breakpoint at the print "C<br>\n"; line. Selecting "debug as
> web page", I would expect to see the output:
>
> A
> B
>
> then have the script suspend at line 4.
>
> However, the browser window pops up empty (I've tried with both Firefox
> and Safari), and the script is suspended at line 4. As soon as I click
> "Resume", I get the full output:
>
> A
> B
> C
> D
>
> Very weird! But it gets weirder.
>
> I change the above script to:
>
> <?php
> phpinfo();
> print "A<br>\n";
> print "B<br>\n";
> print "C<br>\n";
> print "D<br>\n";
>
> ?>
>
> and keep the breakpoint in the same place.
>
> This time when I click "Debug", the phpinfo() output is displayed
> immediately - up until about half way through the "Environment" table,
> but neither of the two print calls display. Once again, the script is
> suspended at my breakpoint, and clicking "Resume" completes the
> phpinfo() output and outputs all my prints.
>
> It sounds like there's some sort of output buffering going on, but I've
> set output_buffering=0 in my php.ini
>
> Any ideas?
>
> On 2008-05-15 01:04:21 +1000, Dave Kelsey <dkel50@hotmail.com> said:
>
>> It would not be possible to maintain backward compatibility with the
>> change that was made. It was an area of the specification that wasn't
>> clear if it had to be explicitly handled or not and as xdebug prior to
>> 2.0.3 didn't use it, I hadn't implemented code to handle it, so cant
>> really blame Derick for the problem.
>> PDT 1.0.3 should be able to handle xdebug 2.0.2 and 2.0.3 without any
>> problems. I don't think the support made it into 1.0.3rc1 through.
>>
>> Dave Kelsey
>>
>> Dan wrote:
>>> Hi Dave,
>>>
>>> Fantastic, thanks for the super quick response! I'll downgrade to
>>> 2.0.2 right away. I actually was running 2.0.2 and only upped to 2.0.3
>>> when I saw it today on the site. So much for dot-dot releases
>>> maintaining backward compatibility!
>>>
>>> On 2008-05-14 18:37:18 +1000, Dave Kelsey <dkel50@hotmail.com> said:
>>>
>>>> Hi Dan, xdebug 2.0.3 is not supported unfortunately. The author made a
>>>> change in 2.0.3 which altered the protocol and as such PDT 1.0.2
>>>> cannot work correctly with it. As you have experienced, the debug
>>>> session never terminates when the request ends. For PDT 1.0.2 you need
>>>> to use Xdebug 2.0.2. Support for Xdebug 2.0.3 wil be available in PDT
>>>> 1.0.3 and PDT 1.1.
>>>>
>>>> It looks like you can get xdebug 2.0.2 from the following link
>>>> http://www.xdebug.org/link.php?url=xdebug202-52-win
>>>>
>>>> As for your other issue, you may want to take a look at flush() for
>>>> more information.
>>>>
>>>> http://www.php.net/flush
>>>>
>>>> Dave Kelsey.
>>>>
>>>>
>>>> Dan wrote:
>>>>> Hi all,
>>>>>
>>>>> Newbie question:
>>>>>
>>>>> Using XDebug 2.0.3/PHP 5.2.6 here on OS X 10.5.
>>>>>
>>>>> When debugging as a "PHP Web page" (as opposed to a "PHP Script"), is
>>>>> there any way to get the script being debugged to generate its output
>>>>> to the browser immediately? It appears to set some sort of output
>>>>> buffering occurs.
>>>>>
>>>>> Take the following piece of code:
>>>>>
>>>>> <?php
>>>>> header("content-type: text/html");
>>>>> print "This is a test<br>\n";
>>>>>
>>>>> $t = new testme();
>>>>>
>>>>> $t->doit(2);
>>>>>
>>>>> print "done<br>\n";
>>>>> exit(0);
>>>>>
>>>>> class testme {
>>>>> public function __construct() {
>>>>> print "Constructing<br>\n";
>>>>> error_log("Constructor",0);
>>>>> }
>>>>> /**
>>>>> * Great little function
>>>>> *
>>>>> * @param int $id - a lovely number
>>>>> */
>>>>> public function doit($id) {
>>>>> print "Doing it with id $id...<br>\n";
>>>>> }
>>>>> }
>>>>> ?>
>>>>>
>>>>> If I set a breakpoint at the "public function doit($id) {" line and hit
>>>>> Debug, the script appears to execute on the server (the results of the
>>>>> error_log() are written to the log) up until the breakpoint.
>>>>>
>>>>> However, none of the "print" calls appear to be getting executed until
>>>>> I restart the process, click "Remote Launch" in the Debug view and then
>>>>> the "Terminate" button - at which point all the output is displayed and
>>>>> the process exits (at which point a second browser window opens for me
>>>>> saying "DEBUG SESSION ENDED".
>>>>>
>>>>> Is there any way I could configure PDT/XDebug to instruct PHP to output
>>>>> the results of the print calls immediately, rather than waiting for the
>>>>> debugging session to end?
>>>>>
>>>>> Thanks in advance!
|
|
|
Goto Forum:
Current Time: Thu Jan 23 14:32:07 GMT 2025
Powered by FUDForum. Page generated in 0.07423 seconds
|