tags:

views:

177

answers:

4

I’m moving the website to a new server and I’m now getting this error!

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/com10002/public_html/bank/index.php:29) in /home/com10002/public_html/bank/includes/quickform.php on line 5

I have put session_start() at the top but it still does not work in Google Chrome! I’m guessing it has somthing to do with the Captcha but it works fine on the old server!

+5  A: 

There’s probably some output before the session_start call. Look at the line 29 in /home/com10002/public_html/bank/index.php where the output started according to the error message.

Make sure that there is no output before functions that might manipulate the HTTP header such as header, setcookie or session_start (if you’re using a session cookie) or use the output control functions to buffer it.

Gumbo
For some reason it works fine on my google-crome browser but noone elses! <?php session_start(); is at the top of the pages! Im not sure how to use the output control function!
You might want to check if there are some invisible characters like a UTF BOM as MrZombie noticed.
Gumbo
i've opened it in notepad and tried it! Still works on mine but not my mates!
The problem with encoding is that you might never see the character on your side. Say you save the file in UTF-8, and the server automatically translates it to ISO, there's going to be junk at the very start of your file, and perhaps pretty much everywhere inside it too. It caused me a big bit of headache in the past.Can also be caused by your files being not all in the same encoding. You might want to try a test page from scratch only containing the whole "problematic" code without inclusion, just copypasta.
MrZombie
Look into the `index.php` at line 29 as the error message states that the output started there.
Gumbo
(And I would try avoiding copy-paste, if you can just quickly code the problematic code in a clean new file and still get the error, then you can rule out encoding. Also, try using NotePad++ and check the option to see each and every single character. You might have a little surprise awaiting in one of the included files.)
MrZombie
A: 

If it worked without error before and now contains error, this might be an encoding issue.

Happened to me before, I think it was something like the server outputs ISO-something and I encode in UTF-8.

MrZombie
A: 

Remember that header() must be called before any actual output is sent, either by normal HTML tags, blank lines in a file, or from PHP.

adatapost
A: 

You're calling session_start() on quickform.php at line 5. This is probably being included from index.php somewhere, and before the include point, you're sending some output.

session_start() must be called only once, before any output. If you just add an additional call at the top, it'll end up being called twice. That is why you're getting this warning.

bdonlan
i commented out the session_start on line 5 of the quickform.php before adding the code to the top of the page so I dont get that error anymore!My problem now is that it working in my google crome and noone elses! Any idea?
It's probably only working because you already have your cookie set. Use firebug to see if the Cookie: header is being sent back with requests; if not, that's your problem.
bdonlan