RE: [PHP] ob_start() -- ob_end_flush() problem

[email protected] ("Arno Kuhl")
Newsgroups php.general
Organization DotContent
Message-ID <[email protected]>
> On Apr 27, 2017, at 11:57 AM, David Harkness <[email protected]> wrote:
> 
> How does it fail? Do they get double output? No output? Fatal error? 
> Car explodes? You're really not giving us much to go on here. :)
> 

My apologies, you are correct I did not give you much to go on, but then again I don’t have much to go on either.

When I said this fails, I meant it didn’t do what it is supposed to do, namely to capture all the output and echo it at one time.

The unfortunate result is nothing happens at all — it is a blank screen wth no errors, not even in the error log.

If you review the code, you will see the script simply takes an image from a database and echo’s it.

The problem described is that *my code* works for me — whereas, *my code* running on my students accounts does not work.

I’ve been told by the Server’s administrator both my account and my student’s accounts are identical. But this script proves something is different.

So, my question is “What is different?”

To try to figure this out, I am asking this group what could cause this? What could possibly go wrong and what questions should I ask the administrator and help him focus on possible problems? For example, I asked if the settings for the output_buffer were the same and he answered “Yes”. So, I am trying to figure out what else to look for? After all, there *is* something different. We should be able to figure out what.

Again, thanks in advance for any help on this.

Cheers,

tedd
_______________
tedd sperling
[email protected]



To try isolate the problem you could test just the output buffering
<?php
	/* start buffered output */
	ob_start();

		// set the header for the image
		header("Content-type: text/plain");
		echo("test-1-2-3\n");

	$page = ob_get_contents();
	/* end buffered output */
	echo($page);
	ob_end_flush();
?>

My output is:
test-1-2-3
test-1-2-3

so as David said the output is repeated (echoed twice before ob_end_flush() ).
If the text output either does or doesn't display on your student's terminal it should highlight where the problem lies.

Cheers
Arno
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.