473,395 Members | 1,452 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Warning: Cannot modify headerm msg

12
I am getting the following error msg whenever I try to login. I tried to turn my output_buffering = On in my php.ini but is not working for me. Would you please help me:

Warning: Cannot modify header information - headers already sent by (output started at C:\Inetpub ........login\include\header.php:9) in C:\Inetpub\vhosts\.....\httpdocs\login\login.php on line 23

And here is the content of the header.php page which is included in all my pages:

Expand|Select|Wrap|Line Numbers
  1. <?php session_start();?>
  2. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  3. <html xmlns="http://www.w3.org/1999/xhtml" lang="en"
  4. <head>
  5.   <meta http-equiv="content-type" content="text/html; charset=utf-8" />
  6.   <meta http-equiv="cache-control" content="no-cache" />
  7.   <meta http-equiv="expires" content="3600" /  
  8.   <meta name="revisit-after" content="2 days" />
  9.   <meta name="robots" content="index,follow" />
  10.   <meta name="publisher" content="<?php echo $publisher;?>" />
  11.   <meta name="copyright" content="<?php echo $copyRight; ?>" />
  12.   <meta name="author" content="<?php echo $author; ?>" />
  13.   <meta name="distribution" content="global" />
  14.   <meta name="description" content="<?php echo $siteDescription; ?>" />
  15.   <meta name="keywords" content="<?php echo $keyWords; ?>" />
  16.   <link rel="stylesheet" type="text/css" media="screen,projection,print" href="./css/setup.css" />
  17.   <link rel="stylesheet" type="text/css" media="screen,projection,print" href="./css/text.css" />
  18.   <link rel="icon" type="image/x-icon" href="./img/favicon.ico" />
  19.   <title><?php echo $pageTitle; ?></title>
  20. </head>
  21.  
  22. <!-- Global IE fix to avoid layout crash when single word size wider than column width -->
  23. <!--[if IE]><style type="text/css"> body {word-wrap: break-word;}</style><![endif]-->
  24. <body>
  25.   <!-- Main Page Container -->
  26.   <div class="page-container">
  27.  
  28.    <!-- For alternative headers START PASTE here -->
  29.  
  30.     <!-- A. HEADER -->      
  31.     <div class="header">
  32.  
  33.       <!-- A.1 HEADER TOP -->
  34.       <div class="header-top">
  35.  
  36.         <!-- Sitelogo and sitename -->
  37.         <a class="sitelogo" href="" title="Go to Start page"></a>
  38.         <div class="sitename">
  39.         <h1><a href="index.php" title="Go to Start page"><?php echo $_SERVER[HTTP_HOST];?><span style="font-weight:normal;font-size:50%;">&nbsp;<?php echo $softwareVersion; ?></span></a></h1>
  40.           <h2><?php echo $softwareVersion; ?><?php echo $companySlogan; ?></h2>
  41.         </div>
  42.  
  43.         <!-- Navigation Level 0 -->
  44.         <div class="nav0">
  45.  
  46.         </div>        
  47.  
  48.         <!-- Navigation Level 1 -->
  49.         <div class="nav1">
  50.           <ul>
  51.             <li><a href="<?php echo $nav11; ?>.php" title="Go to Start page"><?php echo $nav11; ?></a></li>
  52.             <li><a href="<?php echo $nav12; ?>.php" title="Get to know who we are"><?php echo $nav12; ?></a></li>
  53.             <li><a href="<?php echo $nav13; ?>.php" title="Get in touch with us"><?php echo $nav13; ?></a></li>
  54.  
  55. <?php
  56. if(!empty($_SESSION[user_id]))
  57. {
  58. ?>
  59.           <dt><a href="logout.php">Logout</a></dt>
  60.  
  61. <?php
  62. }
  63. else
  64. {
  65. ?>    
  66.             <li><a href="login.php" title="Login to manage your account securely">Login</a></li>
  67. <?php
  68. }
  69. ?>
  70.  
  71.           </ul>
  72.         </div>            
  73.       </div>
  74.  
  75.       <!-- A.2 HEADER MIDDLE -->
  76.       <div class="header-middle">
  77.  
  78.         <!-- Site message -->
  79.         <div class="sitemessage">
  80.           <h1><?php echo $siteMessage1; ?></h1>
  81.           <h2><?php echo $siteMessage2; ?><br /> <?php echo $siteMessage3; ?><br /> <?php echo $siteMessage4; ?></h2>
  82.           <h3><a href="#"><?php echo $moreDetails; ?></a></h3>
  83.         </div>   
  84.       </div>
  85.  
[Please use CODE tags when posting source code. Thanks! --pbmods]
May 30 '07 #1
5 1973
pbmods
5,821 Expert 4TB
Heya, nasse. Welcome to TSDN!

You can't use the header function after you output something, which header.php does in spades.

To get this to work, you need to move your header() statement above the line where you include header.php.

E.g.:

Expand|Select|Wrap|Line Numbers
  1. header('Content-type: wacky/doodle');
  2. include('header.php');
  3.  
May 30 '07 #2
nasse
12
Heya, nasse. Welcome to TSDN!

You can't use the header function after you output something, which header.php does in spades.

To get this to work, you need to move your header() statement above the line where you include header.php.

E.g.:

Expand|Select|Wrap|Line Numbers
  1. header('Content-type: wacky/doodle');
  2. include('header.php');
  3.  
Thank you very much for the prompt response and the effort to resolve the problem.

But the header() statement is also included in this header.php file and is at the top of the header.php:
May 30 '07 #3
pbmods
5,821 Expert 4TB
But the header() statement is also included in this header.php file and is at the top of the header.php:
I don't see it in your code, and the warning you're getting is complaining about C:\Inetpub\vhosts\.....\httpdocs\login\login.php on line 23.
May 31 '07 #4
nasse
12
Thank you very much. I did per your advise and finally worked out for me. Thx once more.
May 31 '07 #5
pbmods
5,821 Expert 4TB
You're welcome.

Good luck with your project! If you get stuck, just post back, and we'll getcha going again ~_^
May 31 '07 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Greg Scharlemann | last post by:
Does the redirect statement: header(Location:"http://www.newpage.com"); need to come before certain statements? I've setup a login page and try to redirect a user once they have logged in...
5
by: Chris Robb | last post by:
I'm having some really odd behavior with a PHP script. I have it populating an HTML select form with a for loop. When I try the years 2006 to 1900. I get the following error: PHP Warning: ...
2
by: mankolele | last post by:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>Simple Database Connection</title> </head> <body bgcolor="white"> <?php $connection =...
4
by: kempy535 | last post by:
Hi I get this error code when I try to run my login script. Warning: Cannot modify header information - headers already sent by (output started at C:\Program Files\Apache Group\Apache2\htdocs\Rising...
8
by: mcserret | last post by:
I know this is a recurring problem that has been addressed here before, but even after reading all that has gone before, I am still stumped. I have a form that is designed to send data to a PHP...
2
by: smartic | last post by:
I'm having problem with header redirection that is my code: <?php header("location:Redirecting.php"); exit; ?> //Then the HTML It give me an error
3
by: gubbachchi | last post by:
Hi, I have written php code to retrive the image from mysql and display it on the webpage. Here is the code <?php require_once("DBConnect.php"); $gotten = @mysql_query("select user_photo from...
10
by: jessica87 | last post by:
hi there, i m using this coding to retrieve the file from database so that my user can download the file... <?php if (!isset($_GET)) die('Invalid Parameter'); include...
3
by: dannynez | last post by:
my problem is in line 58 - header("Location: ".$MM_redirectLoginSuccess); and in line 61-header("Location: ".$MM_redirectLoginFailed); i get this (Warning: Cannot modify header information -...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.