[PHP] $_SESSION NOT WORKING

2008-05-13 Thread Balpo

Hi everyone,
I'm having a problem moving my code to a linux computer.
I won't post the whole code here, but an accurate example that 
reproduces exactly the error.


// 1.php
?php
session_register('tree');
$_SESSION['tree'] = This is tree number one;
header(Location: 2.php);
?

// 2.php
?php
print_r($_SESSION, false);
?


// php.ini (incomplete)
session.save_handler = files
session.save_path = /tmp/php/sessions/ o ;C:/temp/php/sessions for Windows
session.use_cookies = 1
session.name = cito
session.auto_start = 1
session.cookie_lifetime = 0
session.cookie_path = /
session.cookie_domain =
session.cookie_httponly =
session.serialize_handler = php
session.gc_probability = 1
session.gc_divisor = 100
session.gc_maxlifetime = 1440
session.bug_compat_42 = 0
session.bug_compat_warn = 0
session.referer_check =
session.entropy_length = 0
session.entropy_file =
session.cache_limiter = nocache
session.cache_expire = 180
session.use_trans_sid = 0
session.hash_function = 0
session.hash_bits_per_character = 4
url_rewriter.tags = a=href,area=href,frame=src,input=src,form=,fieldset=

The web server is Apache 2.2 with php 5.24 for both, Linux  Windows.
In Linux the Apache server is run by the 'apache' user, which has 
reading, writing and execution grants on /tmp/php/sessions/


The output for 2.php is:
 Array ( [tree] = This is tree number one )
is what I get on Windows, but on Linux I get:
Notice: Undefined variable: _SESSION in /var/www/html/2.php on 
line 2


I don't know what the error is, but something evident is that on Linux 
session.auto_start = 1 is NOT working properly.
On Windows it is not necessary to explicitly start the session to use 
the $_SESSION, so no need to session_start().
If on Linux I add session_start() at the top of each script, the script 
executes well.


I want to know why session.auto_start does not work on Linux.

If you require the whole php.ini, I'll send it gladly


smime.p7s
Description: S/MIME Cryptographic Signature


Re: [PHP] $_SESSION NOT WORKING

2008-05-13 Thread Dmitri

Try adding session_start() at top of the script

Balpo wrote:


Hi everyone,
I'm having a problem moving my code to a linux computer.
I won't post the whole code here, but an accurate example that 
reproduces exactly the error.


// 1.php
?php
session_register('tree');
$_SESSION['tree'] = This is tree number one;
header(Location: 2.php);
?

// 2.php
?php
print_r($_SESSION, false);
?


// php.ini (incomplete)
session.save_handler = files
session.save_path = /tmp/php/sessions/ o ;C:/temp/php/sessions for 
Windows

session.use_cookies = 1
session.name = cito
session.auto_start = 1
session.cookie_lifetime = 0
session.cookie_path = /
session.cookie_domain =
session.cookie_httponly =
session.serialize_handler = php
session.gc_probability = 1
session.gc_divisor = 100
session.gc_maxlifetime = 1440
session.bug_compat_42 = 0
session.bug_compat_warn = 0
session.referer_check =
session.entropy_length = 0
session.entropy_file =
session.cache_limiter = nocache
session.cache_expire = 180
session.use_trans_sid = 0
session.hash_function = 0
session.hash_bits_per_character = 4
url_rewriter.tags = 
a=href,area=href,frame=src,input=src,form=,fieldset=


The web server is Apache 2.2 with php 5.24 for both, Linux  Windows.
In Linux the Apache server is run by the 'apache' user, which has 
reading, writing and execution grants on /tmp/php/sessions/


The output for 2.php is:
 Array ( [tree] = This is tree number one )
is what I get on Windows, but on Linux I get:
Notice: Undefined variable: _SESSION in /var/www/html/2.php on 
line 2


I don't know what the error is, but something evident is that on Linux 
session.auto_start = 1 is NOT working properly.
On Windows it is not necessary to explicitly start the session to use 
the $_SESSION, so no need to session_start().
If on Linux I add session_start() at the top of each script, the 
script executes well.


I want to know why session.auto_start does not work on Linux.

If you require the whole php.ini, I'll send it gladly




--

Open Source ALL content management
with streaming video
http://wiki.sharedlog.com



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] $_SESSION NOT WORKING

2008-05-13 Thread Daniel Brown
On Tue, May 13, 2008 at 2:38 PM, Balpo [EMAIL PROTECTED] wrote:
 Hi everyone,
  I'm having a problem moving my code to a linux computer.
  I won't post the whole code here, but an accurate example that reproduces
 exactly the error.
[snip!]

Modify 2.php as follows:

?php
session_start();
print_r($_SESSION);
?

You only missed instantiating the session.  The rest looks good.

-- 
/Daniel P. Brown
Dedicated Servers - Intel 2.4GHz w/2TB bandwidth/mo. starting at just
$59.99/mo. with no contract!
Dedicated servers, VPS, and hosting from $2.50/mo.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RES: [PHP] $_SESSION NOT WORKING

2008-05-13 Thread Thiago Pojda

Actually his question was about why session.auto_start is not working on
Linux, I almost answered what you both did :)


Atenciosamente,

www.softpartech.com.br


Thiago Henrique Pojda
Desenvolvimento Web
+55 41 3033-7676
[EMAIL PROTECTED]
ExcelĂȘncia em Softwares Financeiros


-Mensagem original-
De: Daniel Brown [mailto:[EMAIL PROTECTED] 
Enviada em: terça-feira, 13 de maio de 2008 16:43
Para: Balpo
Cc: PHP General
Assunto: Re: [PHP] $_SESSION NOT WORKING

On Tue, May 13, 2008 at 2:38 PM, Balpo [EMAIL PROTECTED] wrote:
 Hi everyone,
  I'm having a problem moving my code to a linux computer.
  I won't post the whole code here, but an accurate example that reproduces
 exactly the error.
[snip!]

Modify 2.php as follows:

?php
session_start();
print_r($_SESSION);
?

You only missed instantiating the session.  The rest looks good.

-- 
/Daniel P. Brown
Dedicated Servers - Intel 2.4GHz w/2TB bandwidth/mo. starting at just
$59.99/mo. with no contract!
Dedicated servers, VPS, and hosting from $2.50/mo.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php





--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] $_SESSION NOT WORKING

2008-05-13 Thread Balpo

Yes, that way it works. Thanx.
But the Windows version of the same code and the same php.ini ***does 
not *** need the session_start()

because it has the session.auto_start = 1 inside php.ini.

The thing is,  I think session.auto_start = 1 does not work on Linux.

Is this a bug?

Daniel Brown wrote:

On Tue, May 13, 2008 at 2:38 PM, Balpo [EMAIL PROTECTED] wrote:
  

Hi everyone,
 I'm having a problem moving my code to a linux computer.
 I won't post the whole code here, but an accurate example that reproduces
exactly the error.


[snip!]

Modify 2.php as follows:

?php
session_start();
print_r($_SESSION);
?

You only missed instantiating the session.  The rest looks good.

  


smime.p7s
Description: S/MIME Cryptographic Signature


Re: [PHP] $_SESSION NOT WORKING

2008-05-13 Thread Jens Himmelrath
Balpo schrieb:
 Hi everyone, I'm having a problem moving my code to a linux 
 computer. I won't post the whole code here, but an accurate example
  that reproduces exactly the error.
 
 // 1.php ?php session_register('tree'); 
 $_SESSION['tree'] = This is tree number one; header(Location:
 2.php); ?
 
 // 2.php ?php print_r($_SESSION, false); 
 ?
 
 session.auto_start = 1
 
 I want to know why session.auto_start does not work on Linux.
 
 If you require the whole php.ini, I'll send it gladly

Hi!

Did you test with phpinfo() if the correct php.ini is used?

regards,
Jens


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php