Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Session problem - Cannot send session cache limiter

Status
Not open for further replies.

k23

Programmer
Aug 13, 2004
10
HK
Hi,

This is my 1st time to use session and got the following warning "session_start(): Cannot send session cache limiter - headers already sent" on the line session_start(), i've searched the solutions on the web for 2 days. And most of the cases are the space or lines appear in front of "<?php" or "?>" but i have checked many times to ensure there's no space or lines there and i still get this warning.

Could you help me to solve this problem?
Thanks.

--- Here is my coding ---
*** index.php ***
<?php
session_start();
require("config.php");
?>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
.........coding to retrieve data from MySQL............
</body>
</html>
<?php
mysql_free_result($result);
mysql_close($connection);
?>


*** config.php ***
<?php
$connection = mysql_connect('server','id','password') or die('cannot connect DB!');
$db = mysql_select_db('db', $connection) or die ('cannot select DB');
...... some functions ......
?>


Best Regards,
K23

 
Do you have any ouput, PHP output statements, blank lines before your <?php tag? You can't have any output of any kind before you use a PHP function that manipulates headers. And since PHP, by default, uses cookies with its session-handling system and since cookies must be set in the HTTP header, you have to set up sessions first.

See also section 1.4 of faq434-2999

Want the best answers? Ask the best questions!

TANSTAAFL!!
 
Dear sleipnir214,

Thanks for your kindly help.
Before "<?php" and after "?>" tag, there's no blank line or space.
Is there anything i need to check?
This problem makes me crazy!!!

Thanks.
 
And i used "echo" to print the data within the body only.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top