PDA

View Full Version : [php] configurazione php.ini per sessioni


utrecht
27-09-2003, 16:04
Scusate ma ci sto impazzendo.... Sto cercando di far funzionare le sessioni sul mio pc, attrezzato con apache per win e php. Su un'altra macchina gli stessi files di esempio funzionano ma qui sul mio no.
Vi riporto la parte del mio php.ini relativa alle sessioni perchè penso sia qui l'inghippo.
Ho pensato allora che qualche anima pia, anche di sabato, mi potesse dare una mano.
Mi date una mano? GRAZIE!!

-----
[Session]
; Handler used to store/retrieve data.
session.save_handler = files

; Argument passed to save_handler. In the case of files, this is the path
; where data files are stored. Note: Windows users have to change this
; variable in order to use PHP's session functions.
session.save_path = /tmp

; Whether to use cookies.
session.use_cookies = 0


; Name of the session (used as cookie name).
session.name = PHPSESSID

; Initialize session on request startup.
session.auto_start = 0

; Lifetime in seconds of cookie or, if 0, until browser is restarted.
session.cookie_lifetime = 0

; The path for which the cookie is valid.
session.cookie_path = C:\Documents and Settings\root\Cookies

; The domain for which the cookie is valid.
session.cookie_domain =http://localhost

; Handler used to serialize data. php is the standard serializer of PHP.
session.serialize_handler = php

; Percentual probability that the 'garbage collection' process is started
; on every session initialization.
session.gc_probability = 1

; After this number of seconds, stored data will be seen as 'garbage' and
; cleaned up by the garbage collection process.
session.gc_maxlifetime = 1440

; Check HTTP Referer to invalidate externally stored URLs containing ids.
session.referer_check =

; How many bytes to read from the file.
session.entropy_length = 0

; Specified here to create the session id.
session.entropy_file =

;session.entropy_length = 16

;session.entropy_file = /dev/urandom

lalli83
27-09-2003, 16:36
io ho il file settato come il tuo ma nn mi da problemi..prova a postare il codice e vedo se qui gira

utrecht
27-09-2003, 22:06
esempio base per sessione:
- pagina1.php -
<?
session_start();
$_SESSION['test']="oggetto";
echo "<a href=\"pagina2.php?$PHPSESSID\">avanti</a>";
?>

ma in pagina2.php non leggo niente:

- pagina2.php -
session_start();
echo "var di sessione: <b>".$_SESSION['test']."</b><br>";
echo "<a href=\"pagina1.php?$PHPSESSID\">dietro</a>";
?>

lalli83
28-09-2003, 12:21
prova ad aggiungere session_register("test") nella prima pagina dopo session_start();
;)

cionci
28-09-2003, 18:35
Il codice va bene... Haic reato la directory c:\tmp ?

utrecht
29-09-2003, 11:26
Sì, infatti lì dentro mi ci scrive il file di sessione.... potrebbe dipenderer dal fatto che register_global su una macchina è settato a 'on' (e infatti gira tutto bene) e sull'altra l'ho settata a 'off'?