0

I've seen this questions milions of times, but none of the solutions works for mine.

This works on my pc, but not on a web-hosting. Is it something to do with the php.ini or httpd.conf ?

<?php
ob_start();
setcookie("show","1",time() + 300);
?>

<html xmlns="http://www.w3.org/1999/xhtml">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>UDO - Under Development Office</title>

    <body>
        Hello World!
    </body>

</html>

Later edit:

<?php 
    var_dump(ob_get_contents());
?>

Prints: bool(false)

AND

<?php
    ob_start();
    var_dump(ob_get_contents());
?>

Prints: string(0) ""

This is not a duplicate question since none of the questions asked before on Stackoverflow resolved this issue.

I must insist that this works on my Mac OS X with PHP 5.3.6, but not on a shared host(same PHP version).

Dan Cearnau
  • 817
  • 1
  • 10
  • 15
  • possible duplicate of [Warning: Cannot modify header information - headers already sent](http://stackoverflow.com/questions/3190833/warning-cannot-modify-header-information-headers-already-sent) – mario Nov 29 '11 at 13:12

2 Answers2

2

I also encountered this exact problem and finally found a solution. You have to save the file without the utf-8 BOM signature since that includes a character at the top of the document.

In adobe dreamviewer I just had to uncheck the "Include Unicode Signature (BOM)" when saving the file and my problem was solved.

zchwyng
  • 31
  • 5
0

This means, that output have already started before. Try reading ob_get_contents() before ob_start() to find what it was;

var_dump(ob_get_contents());
Nameless
  • 2,306
  • 4
  • 23
  • 28