Jump to content

session_start() problem in localhost


robert_gsfame

Recommended Posts

this problem really drives me crazy..hope that anyone could help.

 

I left my page only with

<?php

session_start();

?>

with no script at all..and i still got error

 

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at E:\Program Files\XAMPP 1.5.4\xampp\htdocs\folder\page1.php:1) in E:\Program Files\XAMPP 1.5.4\xampp\htdocs\folder\page1.php on line 2

 

No white space at all. I tried to upload this file into the server (not local) and no error appeared. but when i run it in my local server, error appeared.

 

I restart my xampp so many times but still didn't fix this.

 

what's the problem then?

 

thx in advance

 

Link to comment
https://forums.phpfreaks.com/topic/255068-session_start-problem-in-localhost/
Share on other sites

your code editor is encoding your script with a BOM (you can google BOM if you don't know what it is), which outputs to the browser, thus rendering session_start problematic, since no output can be sent to the browser before calling that function. You will need to change you encoding type to UTF-8 without BOM. should be in the settings, under encoding, depending on what editor you are using.

display_errors is probably off on your hosting server, but the error is still there. Open the file in your editor, go into your options and make sure it is set up to save files as UTF-8 without BOM. See if that fixes the problem.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.