How can I share variables between two processes?
Here is my problem?
File test1.php:
-------------------------------------------------------------------
<?php
session_start() ;
$var1="This should";
$var2="be displayed";
$_SESSION[ 'var1' ]=$var1;
$_SESSION[ 'var2' ]=$var2;
if (session_is_reg istered('var1') ) {
print "Var1 is registered<br>" ;
}
if (session_is_reg istered('var2') ) {
print "Var2 is registered<br>" ;
}
print "<A HREF=/work/test2.php>Secon d File</A>";
?>
File test2.php
-------------------------------------------------------------------
<?php
if (session_is_reg istered('var1') ) {
print "test2:Var1 is registered<br>" ;
}
if (session_is_reg istered('var2') ) {
print "test2:Var2 is registered<br>" ;
}
$var1=$_SESSION[ 'var1' ];
$var2=$_SESSION[ 'var2' ];
print "$var1 $var2 <br>";
?>
Nothing gets displayed. I think that the problem lies in the fact that
these two files are handled by two processes, but I also think that
httpd process should be able to get the cookie from the browser and
read the sess* file containing the variables:
var1|s:11:"This should";var2|s: 12:"be displayed";
How can I achieve proper sharing of the information, short of developing
a complex scheme with shmop, which would mean complete relink and,
basically, reinstallation of PHP? I apologize in advance if the question
is elementary, but I was absolutely unable to find the answer in either
PHP online pages or O'Reilly book.
--
Trust me, I know what I'm doing. (Sledge Hammer)
Here is my problem?
File test1.php:
-------------------------------------------------------------------
<?php
session_start() ;
$var1="This should";
$var2="be displayed";
$_SESSION[ 'var1' ]=$var1;
$_SESSION[ 'var2' ]=$var2;
if (session_is_reg istered('var1') ) {
print "Var1 is registered<br>" ;
}
if (session_is_reg istered('var2') ) {
print "Var2 is registered<br>" ;
}
print "<A HREF=/work/test2.php>Secon d File</A>";
?>
File test2.php
-------------------------------------------------------------------
<?php
if (session_is_reg istered('var1') ) {
print "test2:Var1 is registered<br>" ;
}
if (session_is_reg istered('var2') ) {
print "test2:Var2 is registered<br>" ;
}
$var1=$_SESSION[ 'var1' ];
$var2=$_SESSION[ 'var2' ];
print "$var1 $var2 <br>";
?>
Nothing gets displayed. I think that the problem lies in the fact that
these two files are handled by two processes, but I also think that
httpd process should be able to get the cookie from the browser and
read the sess* file containing the variables:
var1|s:11:"This should";var2|s: 12:"be displayed";
How can I achieve proper sharing of the information, short of developing
a complex scheme with shmop, which would mean complete relink and,
basically, reinstallation of PHP? I apologize in advance if the question
is elementary, but I was absolutely unable to find the answer in either
PHP online pages or O'Reilly book.
--
Trust me, I know what I'm doing. (Sledge Hammer)
Comment