Warning: Cannot modify header information

8 posts by 3 authors in: Forums > CMS Builder
Last Post: November 8, 2012   (RSS)

By ThreeTree - May 25, 2012 - edited: May 26, 2012

Haven't worked with CMS Builder for some time. Attempting to set up test page incorporating CMS in existing site. Getting this message: Warning: Cannot modify header information - headers already sent by (output started at /home/content/18/8537518/html/test_index2.php:3) in /home/content/18/8537518/html/test_index2.php on line 3

Obviously I've inserted the generated code above the <head> incorrectly but can't correct it.

Figured it out and have the info above head correct. But error messages indicate that I need to remove closing / from a number of commands.

Re: [ThreeTree] Warning: Cannot modify header information

By Dave - May 26, 2012

Hi ThreeTree,

Make sure you don't have any spaces, enters, or HTML before the first <?php block that load the viewer_functions.php library.

Let me know if that works for you.
Dave Edis - Senior Developer
interactivetools.com

Re: [Dave] Warning: Cannot modify header information

By jacgo - November 8, 2012

Hi Dave

I got same problem.

the error message is :
Warning[/#666666]: Cannot modify header information - headers already sent by (output started at /home/quanmax/public_html/about_index.php:1) in /home/quanmax/public_html/about_index.php on line 1

The header code in my page is :[/#666666]

<?php header('Content-type: text/html; charset=utf-8'); ?>
<?php


// load viewer library
$libraryPath = 'cmsAdmin/lib/viewer_functions.php';
$dirsToCheck = array('/home/quanmax/public_html/','','../','../../','../../../');
foreach ($dirsToCheck as $dir) { if (@include_once("$dir$libraryPath")) { break; }}
if (!function_exists('getRecords')) { die("Couldn't load viewer library, check filepath in sourcecode."); }

// load record from 'about_index'
list($about_indexRecords, $about_indexMetaData) = getRecords(array(
'tableName' => 'about_index',
'where' => '', // load first record
'loadUploads' => true,
'allowSearch' => false,
'limit' => '1',
));
$about_indexRecord = @$about_indexRecords[0]; // get first record
if (!$about_indexRecord) { dieWith404("Record not found!"); } // show error message if no record found

?>



I can not find the errors.

Jac

Re: [jacgo] Warning: Cannot modify header information

By Dave - November 8, 2012

Hi Jacgo,

Make sure you don't have any spaces or enters before this line:
(check here)<?php header('Content-type: text/html; charset=utf-8'); ?>
<?php


And if you still get the error, remove the code in red:
<?php header('Content-type: text/html; charset=utf-8'); ?>
<?php


Let me know if that works for you. Thanks!
Dave Edis - Senior Developer
interactivetools.com

Re: [jacgo] Warning: Cannot modify header information

By Dave - November 8, 2012

Hi jacgo,

Try removing this line:
<?php header('Content-type: text/html; charset=utf-8'); ?>

If that doesn't work, can you attach the file to the post? I can take a look for you but I need to see the file directly to catch any stray spaces or things like that that might be causing the issue.

Thanks.
Dave Edis - Senior Developer
interactivetools.com

Re: [Dave] Warning: Cannot modify header information

By jacgo - November 8, 2012

Hi Dave

Great!
After removed the first line.
[font "Verdana"]<?php header('Content-type: text/html; charset=utf-8'); ?>[/#000000]

All code fine now.
Feedback:
before removing the first line.
Some of our CSS effect can not display properly.
after it. All the css can be displayed properly.

Do know why.
Do I need to remove all the code from cmsAdmin?

Thanks for help.

Jacgo.

Re: [jacgo] Warning: Cannot modify header information

By Dave - November 8, 2012

Hi Jacgo,

If it works better without that line just remove it.

It's just trying to get all the servers and browsers to see the page the same way, but if it's working without it you don't need it.
Dave Edis - Senior Developer
interactivetools.com