Hello Php Champs,

I am new in php , I am getting this problem
Warning: session_start() [function.session-start]:
Cannot send session cache limiter - headers already sent

I have written the following code at the top of header.php

<?php ob_start(); 
session_name(); 
session_start(); ?>

I am new, failed to understand what could be the reason ..

Thanks a ton

Recommended Answers

All 4 Replies

You're sure you have placed it at the very top of the page before any type of html output? If not, they should be the very first 3 lines of the page before anything gets sent to the browser, including whitespace.

What text encoding/format is your php or text editor saving the file in?

Hi CFROG,

Yes i have placed the code on top of the page, there is no space before taht

<?php ob_start(); session_name(); session_start(); ?>


What could be the other possibilities ?

Thanks

Another tutorial to write about. This problem can be caused by using a text editor that adds invisible junk code at the beginning of the text file. First replace your code with the following:

<?php session_start();
ob_start(); ?>

Then save it and reopen in windows notepad. Yer that old fashion program. After that click just before the first p on line 1 and press backspace 10 times. Then type back in the <? symbols and click save. After that upload to your server and see if it works.

Btw, could you tell me what text editor your using so I can download a copy to replicate the problem.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.