Jump to content

Cannot send session cookie - headers already sent by (url)


karstev

Recommended Posts

This is doing my head in,
I am using php 5.1.4, Appache Server 2.2.3 on windows xp(sp2), I am just trying to get a simple session going, I have no complicated stuff, definately no spaces before my <?php declare, definately no spaces after ?>
my snytax is as follows, when I run this I cannot see a value for the variable, my session directory produces a file containing

"views|i:1;".

<?php
session_start();
$_SESSION['views'] = 1;
echo "Pageviews = ". $_SESSION['views'];
?>
Im pretty sure my php.ini settings are correct as I have reinstalled, followed all the tutes
----------------------- session settings ---------------------------------------
session.auto_start - off
session.use_trans_sid - 0
session.use_only_cookies - off
session.use_cookies - on


Link to comment
Share on other sites

karstev,

A somewhat stretching -- posiblity is if you use Smarty or some other templating system,

Smarty has the ability to filter output, and may have added text prior to your <?PHP,

Unfortunately, I've only encountered that error when some text (not just spaces) was output before the session_start().

Depending on your platform, sometimes invisible characters could be 'hiding' out.

You might try the old standby, rebuilding the file from scratch, though you've probably already tried it  :-X

Sorry if that doesn't help.

Jeff
Link to comment
Share on other sites

Karen,

I've kept my templating system (Smarty) on a very short leash for a long time,

and now that I know it fairly well, I've begun to play with it.

Smarty may not be the latest and greatest, but it's stable, and extensible, and
worst case you can just write straight php, and it doesn't get offended :)

Jeff
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.