-1

Possible Duplicate:
Headers already sent by PHP
Reference - What does this error mean in PHP?

<?php
include 'connect.php';
include 'header.php';
?>      
<p>Mahtava is an organization dedicated to providing great services and web projects to people for free. We are passionate about the web and making it a better place for its citizens to live in. We have a strong emphasis on the user experience in whatever we do, and are focussed on keeping things the best for our users. Many of our projects are open source, and we always are inviting new developers to help with them or to develop projects of their own with us.</p>
<?php
include 'footer.php';
?>

What is wrong with the above code? It keeps giving me

'Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/u599980382/public_html/newsite/index.php:1) in /home/u599980382/public_html/newsite/connect.php on line 2'.

It doesn't do this on any other pages, not even a page with almost the same exact code (only the content is different); it only does this on the index. Thanks in advance for any help you may be able to provide.

Community
  • 1
  • 1
user1640021
  • 100
  • 1
  • 6
  • 2
    Most likely something before the `session_start()` is sending output to the browser. This would be easier to debug if you provide the code for your scripts, mainly where the `session_start()` code is and anything before it. – PhearOfRayne Jan 05 '13 at 05:30
  • your code is ok. It might be error of connect.php or header.php. i think your this code is ok. i try this code with my header, footer and connection file. then it worked. :) – Nytram Jan 05 '13 at 05:38
  • This can be caused by any output before `session_start()`, even if there is a single space before your php tag - `-> – Sean Jan 05 '13 at 05:42
  • It happens ONLY on index.php; none of the other pages have errors. – user1640021 Jan 05 '13 at 15:41
  • It was because it was UTF-8 with BOM. Changed character encoding to ANSI, and things are fine. – user1640021 Jan 05 '13 at 15:46

1 Answers1

0

for use of header functions headers have not been sent you can check it by headers_sent

// If no headers are sent, send one
if (!headers_sent()) {
......
}

you can change your code to this case:

<?php
include 'header.php';
include 'connect.php';
include 'content.php';
?>