Sessions are not working for me, help please!
| From: | Roberto Diaz | Date: | Sat, 13 Nov 1999 16:28:32 +0000 |
| Subject: | Sessions are not working for me, help please! | ||
| Groups: | php.version4 | ||
| Request: | Send a blank email to php-version4+get-6219@lists.php.net to get a copy of this message | ||
Hi!
I was using php3 one year ago this is my first contact with php since then
so i've decided to give a try to php4, the most important feature for me
now are sessions..
I've compiled php4 with this options:
./configure --with-apache=/usr/local/apache --with-mysql=/usr
--with-pgsql=/usr --with-session=/tmp
--enable-safe-mode=yes --enable-track-vars=yes
--with-apxs=/usr/local/apache/bin/apxs
And all seems to work fine, all but sessions..
here's my php.ini file (all related with sessions):
----------------------------------------------------------------------------
[Session]
session.save_handler = files ; handler used to store/retrieve data
session.save_path = /tmp ; argument passed to save_handler
; in the case of files, this is the
; path where data files are stored
session.name = PHPSESSID ; name of the session
; is used as cookie name
session.auto_start = 0 ; initialize session on requeststartup
session.lifetime = 0 ; lifetime in seconds of cookie
; or if 0, until browser is restarted
session.serialize_handler = php ; handler used to serialize data
; php is the standard serializer of PHP
session.gc_probability = 1 ; procentual probability that the
; 'garbage collection' process is started
; on every session initialization
session.gc_maxlifetime = 1440 ; after this number of seconds, stored
; data will be seen as 'garbage' and
; cleaned up by the gc process
--------------------------------------------------------------------------
I'm trying the following scripts:
--------------------------------------------------------------------------
<!-- test1.php-->
<?
session_start();
$var = "Hello";
printf("variable registrada es %s\n", $var);
session_register("var");
?>
This is page 1. Click <a href="test2.php">here</a> to go to page 2.
<!-- test2.php -->
<?session_start();?>
And your session variable is
<p>
aqui deberia ir algo--><?echo $var?>
<p>
and your session id is
<? echo session_id(); ?>
<?session_destroy();?>
<p>And now your session is over :(
---------------------------------------------------------------------------
The result for test1.php is the following:
*****************************************************************
Warning: Cannot add header information - headers already sent in
/usr/local/apache/htdocs/test1.php on line 3
variable registrada es Hello This is page 1. Click here to go to page 2.
*************************************************************************
all seems to work but the warning message :????????????
After this I get a file in /tmp like this:
cat e69726252fbaee4fd10577f4b2b429ac raises: var|s:5:"Hello";
OK it looks fine but when i use the second script (called from the first
one) I get this:
-----------------------------------------------------------------
Warning: Cannot add header information - headers already sent in
/usr/local/apache/htdocs/test2.php on line 3
And your session variable is
aqui deberia ir algo-->
and your session id is 22f8a11450f389c9abbdba40387ec46f
And now your session is over :(
------------------------------------------------------------------
So it isnt recieving the registered variable.. and once again the warning
message..
What is wrong? please need help!
Saludos
Roberto Díaz <rdiazmar@nova.es>
http://www.linuxfocus.org/developer/Roberto