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
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
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.
interactivetools.com
Re: [Dave] Warning: Cannot modify header information
By jacgo - November 8, 2012
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
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!
interactivetools.com
Re: [Dave] Warning: Cannot modify header information
By jacgo - November 8, 2012
Thanks for the quick reply!
There is no space before the code
<?php header('Content-type: text/html; charset=utf-8'); ?>
<?php
and removed the ?>
<?php [/#ff0000]
still got error.
Here is my head code:
<?php header('Content-type: text/html; charset=utf-8');
// 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
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3c.org/TR/1999/REC-html401-19991224/loose.dtd">
<!-- saved from url=(0040)Annual Report.html -->
<HTML xmlns="http://www.w3.org/1999/xhtml">
<HEAD>
<TITLE>Quanmax Inc. - Investor Relations - Annual Report</TITLE>
<META content="text/html; charset=utf-8" http-equiv=Content-Type>
<LINK
rel=stylesheet type=text/css href="css/web_css.css">
<LINK
rel=stylesheet type=text/css href="css/layer_css.css">
<SCRIPT type=text/javascript src="script/headercode.js"></SCRIPT>
<SCRIPT type=text/javascript
src="script/AC_RunActiveContent.js"></SCRIPT>
<META name=GENERATOR content="MSHTML 8.00.6001.19328">
</HEAD>
I thought it is Dreamweaver problem. but I do the work many times. It is the error I met in first time.
Hope you can help.
Thanks!
Jac
Re: [jacgo] Warning: Cannot modify header information
By Dave - November 8, 2012
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.
interactivetools.com
Re: [Dave] Warning: Cannot modify header information
By jacgo - November 8, 2012
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
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.
interactivetools.com