This is a discussion on "session php" within the PHP Forum section. This forum, and the thread "session php are both part of the Program Your Website category.
|
|
|
|
|
![]() |
||
session php
|
||
| Notices |
![]() |
|
|
LinkBack | Thread Tools |
|
|||
|
session php
ok in php i have try'ed this standard example
<?php // page1.php session_start(); echo 'Welcome to page #1'; $_SESSION['favcolor'] = 'green'; $_SESSION['animal'] = 'cat'; $_SESSION['time'] = time(); // Works if session cookie was accepted echo ' page 2'; // Or maybe pass along the session id, if needed echo ' page 2'; ?> ok the sample from php.net but i get this error when i launch it. Warning: session_start(): Cannot send session cookie - headers already sent by (output started at /usr/local/apache/htdocs/zoli/test.php:9) in /usr/local/apache/htdocs/zoli/test.php Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /usr/local/apache/htdocs/zoli/test.php:9) in /usr/local/apache/htdocs/zoli/test.php Welcome to page #1 page 1 here is a link were i try to run the pages http://www.vibrantday.com/test/text/test.php Anybody |
|
|
|
|||
|
Sessions use cookies.
You can't have a single line printed to the client otherwise, the headers are sent. You can't send the headers twice. Cookies must be sent before ANYTHING else in the page because they go in the header. Thus this code will only work if it's the first thing in your document. |
![]() |
| Tags |
| session, php |
| Thread Tools | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| are session safe? | alexgeek | PHP Forum | 8 | Aug 30th, 2007 10:45 |
| Help with SESSION vars, please? | Donny Bahama | PHP Forum | 3 | May 28th, 2007 15:53 |
| Session variables | ideleon | PHP Forum | 2 | Feb 7th, 2006 08:04 |
| Session Problems :( | benbacardi | PHP Forum | 8 | Jun 1st, 2005 18:51 |
| session problem | fender79 | Classic ASP | 8 | May 18th, 2005 02:26 |