0

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!

bdonlan
  • 224,562
  • 31
  • 268
  • 324

4 Answers4

5

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
  • 643,351
  • 109
  • 780
  • 844
  • For some reason it works fine on my google-crome browser but noone elses! –  Aug 03 '09 at 15:00
  • You might want to check if there are some invisible characters like a UTF BOM as MrZombie noticed. – Gumbo Aug 03 '09 at 15:03
  • i've opened it in notepad and tried it! Still works on mine but not my mates! –  Aug 03 '09 at 15:19
  • 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. – Olivier Tremblay Aug 03 '09 at 15:28
  • Look into the `index.php` at line 29 as the error message states that the output started there. – Gumbo Aug 03 '09 at 15:28
  • 1
    (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.) – Olivier Tremblay Aug 03 '09 at 15:30
0

please put ob_start(); before your session_start(); and start of the page.Then clear your cache and see it should work.

Taryn
  • 242,637
  • 56
  • 362
  • 405
jai
  • 547
  • 7
  • 20
0

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.

Olivier Tremblay
  • 1,441
  • 2
  • 20
  • 37
0

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
  • 224,562
  • 31
  • 268
  • 324
  • 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? –  Aug 03 '09 at 15:10
  • 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 Aug 03 '09 at 15:31