T
T
thecashit2013-07-25 10:05:11
PHP
thecashit, 2013-07-25 10:05:11

Debugging in phpStorm and stream output

Good day!

I'm trying to catch the annoying "Headers already sent by" using phpStorm.
Is there any way to output the STDOUT stream to the console or to variables?
I want to run through the debugger and find the place where the line break appears.

Answer the question

In order to leave comments, you need to log in

6 answer(s)
A
Anatoly, 2013-07-25
@taliban

utf-8 + bom is often affected

V
Vitaly, 2013-07-25
@xytop

Well, “Headers already sent by” tells you where they have already been sent. You just need to look carefully there. Well, if possible, insert die () there and see what is displayed there in all its glory. Most likely some kind of warning or error

M
Max, 2013-07-25
@7workers

you can try calling the script from the console, past the web server:
$ php /path/to/index.php

P
pav, 2013-07-25
@pav

STDOUT can be buffered and passed the value of the buffer to a variable.
<?php
ob_start();
...code...
$out = ob_get_contents();
?>

S
Stanislav Gamayunov, 2013-07-25
@happyproff

Try xdebug, its error output should help.

A
Arks, 2013-07-30
@Arks

the first line ob_start(callable<... function...>)
will catch everything, including fatal error

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question