0

I have an application that works fine on my local server(wamp, apache v2.22.2, php 5.4.3) and test unix server (apache, php 5.3).
But it won't work on production server which is running on Windows because of some other requirements.
Code goes like this:

function renderFile()
...
ob_start();
ob_implicit_flush(false);
require($_viewFile_);
return ob_get_clean();

Problem is that the contents of the file that is included is outputed immediately and not returned from function.
The thing is it works on local and test servers but not on new production server which is on windows. Is it because of apache/iis or php configuration?

Alessandro Minoccheri
  • 35,521
  • 22
  • 122
  • 171
praxus
  • 488
  • 1
  • 7
  • 18

1 Answers1

1
function renderFile() {
  ob_start();
  include($_viewFile_);
  $view = ob_get_contents();
  ob_end_clean();
  return $view;
}

Do what you want with $view now.

echo renderFile();
wesside
  • 5,622
  • 5
  • 30
  • 35
  • No, that's not it. ob_get_clean — Get current buffer contents and delete current output buffer. Plus, why would it work on two other servers and not this one. And ob_implicit_flush(false) is that so flush doesn't happen on every output call. – praxus Sep 21 '12 at 03:28