Hi, i am getting the following errors when running my php script:
Warning: Cannot send session cookie - headers already sent by (output
started at
c:\apache\apache2\htdocs\thegain\index.php:4) in
c:\apache\apache2\htdocs\thegain\index.php on line 19
Warning: Cannot send session cache limiter - headers already sent
(output started at
c:\apache\apache2\htdocs\thegain\index.php:4) in
c:\apache\apache2\htdocs\thegain\index.php on line 19
....the script i am trying to run is as follows:
<?php
session_start(); //start session to get session variables
//this code is to check if a custom session variable exists. if none,
create one.
if (!isset($custom_sessid)) {
$custom_sessid = md5($_SERVER['REMOTE_ADDR'] . " " . date("Y-m-d
H:i:s")); // create a session id
session_register("custom_sessid"); // register newly ceated session
variable
}
$indate = date("Y-m-d H:i:s");
$page_id = 1; //each page will have its own number
$insert = "INSERT INTO tracker (tracker_id, page_id, indate,
custom_sessid) values (null, $page_id,
'$indate', '$custom_sessid')";
$result = mysql_query($insert);
?>
....the purpose of the tracker table is to log the session id and the
page number to have a complete log of pages visited by a user
(identified by their session id) to allow me to build some form of
site statistics but for some reason i am getting an error (see above).
does anybody know why this is?? cheers
burnsy 2 21843
"mr_burns" <bi******@yahoo.co.uk> wrote in message
news:65**************************@posting.google.c om... Hi, i am getting the following errors when running my php script: Warning: Cannot send session cookie - headers already sent by (output started at
c:\apache\apache2\htdocs\thegain\index.php:4) in c:\apache\apache2\htdocs\thegain\index.php on line 19
Warning: Cannot send session cache limiter - headers already sent (output started at
c:\apache\apache2\htdocs\thegain\index.php:4) in c:\apache\apache2\htdocs\thegain\index.php on line 19 ...the script i am trying to run is as follows: <?php
session_start(); //start session to get session variables
//this code is to check if a custom session variable exists. if none, create one. if (!isset($custom_sessid)) {
$custom_sessid = md5($_SERVER['REMOTE_ADDR'] . " " . date("Y-m-d H:i:s")); // create a session id session_register("custom_sessid"); // register newly ceated session variable
}
$indate = date("Y-m-d H:i:s"); $page_id = 1; //each page will have its own number
$insert = "INSERT INTO tracker (tracker_id, page_id, indate, custom_sessid) values (null, $page_id,
'$indate', '$custom_sessid')"; $result = mysql_query($insert);
?>
...the purpose of the tracker table is to log the session id and the page number to have a complete log of pages visited by a user (identified by their session id) to allow me to build some form of site statistics but for some reason i am getting an error (see above).
does anybody know why this is?? cheers
burnsy
Hey Burnsy,
Are there any spaces before your <?php tag.
If there are these will be outputed, thus sending a header.
RG
"RG" <Me@NotTellingYa.com> wrote in message news:<3f***********************@mercury.nildram.ne t>... "mr_burns" <bi******@yahoo.co.uk> wrote in message news:65**************************@posting.google.c om... Hi, i am getting the following errors when running my php script: Warning: Cannot send session cookie - headers already sent by (output started at
c:\apache\apache2\htdocs\thegain\index.php:4) in c:\apache\apache2\htdocs\thegain\index.php on line 19
Warning: Cannot send session cache limiter - headers already sent (output started at
c:\apache\apache2\htdocs\thegain\index.php:4) in c:\apache\apache2\htdocs\thegain\index.php on line 19 ...the script i am trying to run is as follows: <?php
session_start(); //start session to get session variables
//this code is to check if a custom session variable exists. if none, create one. if (!isset($custom_sessid)) {
$custom_sessid = md5($_SERVER['REMOTE_ADDR'] . " " . date("Y-m-d H:i:s")); // create a session id session_register("custom_sessid"); // register newly ceated session variable
}
$indate = date("Y-m-d H:i:s"); $page_id = 1; //each page will have its own number
$insert = "INSERT INTO tracker (tracker_id, page_id, indate, custom_sessid) values (null, $page_id,
'$indate', '$custom_sessid')"; $result = mysql_query($insert);
?>
...the purpose of the tracker table is to log the session id and the page number to have a complete log of pages visited by a user (identified by their session id) to allow me to build some form of site statistics but for some reason i am getting an error (see above).
does anybody know why this is?? cheers
burnsy
Hey Burnsy, Are there any spaces before your <?php tag. If there are these will be outputed, thus sending a header. RG
hi,
ive figured out the problem. i didnt have the start_session() command
at the top of the page (whoops). i completely forgot that it had to go
there. thanks anyway.
burnsy This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: sky2070 |
last post by:
session_start();
$_SESSION++;
print 'You have visited here '.$_SESSION.' times.';
returned:
Warning: session_start() :
open(/tmp\sess_c8bf2007256f6e15a938c0254adb21e4, O_RDWR) failed: No...
|
by: Ray Torres |
last post by:
I get a warning and cannot start a session. I understand from reading
through the documentation and other posts that session_start must occur in
the php script before any HTML tags or output to...
|
by: Ganesh |
last post by:
Hi all!
I'm new to PHP...
I wrote a php script for login page, which creates some session
variables after validating the user... But it's not working...
When i compile it... The compiler is...
|
by: cowofchaos |
last post by:
when I use the session_start() function at the top of my scripts I get
5 errors on the page
If anyone can help please do this has been a problem for a while and I
cannot do much more work on my...
|
by: lkrubner |
last post by:
I was trying to set a cookie before I called session_start() and it was
giving me an error. But isn't sessions really just a cookie? Why would
it matter if I sent a cookie before session_start? Can...
|
by: lawrence k |
last post by:
I'm getting this warning:
PHP Warning: session_start(): Cannot send
session cache limiter - headers already sent in...
|
by: lawrence k |
last post by:
How can I find out where my script is outputting to the screen for the
first time?
My error logs are full of stuff like this:
PHP Warning: session_start(): Cannot send
session cache...
|
by: juergen |
last post by:
Hi,
there are many postings on this subject, I have read them put don't
have an answer.
I get these warnings: Cannot send session cookie - headers already sent
in,
but my php-scripts are okay.
...
|
by: Garry Jones |
last post by:
This is a excerpt from the code where I collect data with a form.
<FORM action="index15dq.php" method="post" name="stegscf_pwd_edit"
id="stegscf_pwd_edit">
I am setting three session variables...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
| |