文件上传后“标题已发送”错误[重复]

This question already has an answer here:

After I uploaded my files this kind of error is occurred. But there is no any errors in my localhost. What kind of error is this? How to fix this?

Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at /home/lahiruca/public_html/events/includes/links.php:1) in /home/lahiruca/public_html/events/includes/header.php on line 1

(from the comments)

<?php session_start();?> 
<div class="header"> 
<div class="logo"></div> 
<div class="right_header"> 
<div class="top_right_header"> 
  <ul> <?php if(isset($_SESSION['userid'])){ ?> 
</div>

As the error says: You are trying to send headers (using the function session_start), but headers are allready sent.

Ways headers can be sent:

  • output is generated: this can be intended, like you allready did an echo,
  • or unintended (most of the times there can be some sort of whitespace in front of you <?php code. Or after a closing ?> in an included file
  • the header function