View Full Version : PHP Problems
Westman40
30-09-2008, 11:31 PM
Hey guys,
I've just edited my config file for my radio stats, and I keep getting the following error:
Warning: session_start() [function.session-start (http://afterhabbo.net/live/stats/function.session-start)]: Cannot send session cache limiter - headers already sent (output started at /home/afterhab/public_html/live/stats/radio_stats.php:2) in /home/REMOVED/public_html/staff/includes/config.php on line 3
Anybody know the cause of this?
Excellent2
30-09-2008, 11:37 PM
Post the code?
Decode
01-10-2008, 07:07 AM
Remove line 3, its already been sent in an include or something.
Calon
01-10-2008, 09:57 AM
session_start() can only be at the top, well after/before other functions like ob_start()
Source
01-10-2008, 11:36 AM
As far as my own personal knowledge extends you cannot have any anything outputted to the browser before session_start() is used for example:
This would error
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en">
<head>
<?php
session_start();
?>
That is because you have sent an output to the browser, in this case in HTML form. The proper way todo it would be:
<?php
session_start();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en">
<head>
I may be wrong but that's what my personal understanding is. Also note I have seen a single space before PHP tags to have also affected it.
As far as my own personal knowledge extends you cannot have any anything outputted to the browser before session_start() is used for example:
This would error
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en">
<head>
<?php
session_start();
?>
That is because you have sent an output to the browser, in this case in HTML form. The proper way todo it would be:
<?php
session_start();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en">
<head>
I may be wrong but that's what my personal understanding is. Also note I have seen a single space before PHP tags to have also affected it.
I support that theory ;)
Want to hide these adverts? Register an account for free!
Powered by vBulletin® Version 4.2.5 Copyright © 2025 vBulletin Solutions Inc. All rights reserved.