Page 2 of 2
Posted: Fri Oct 03, 2003 8:14 am
by yaron
Which settings do you mean?
global_variables=on
and I have specified a session save path for apache.
Posted: Fri Oct 03, 2003 8:21 am
by yaron
here is the session part on my php.ini:
[Session]
session.save_handler = files ; handler used to store/retrieve data
session.save_path = c:\Temp ; argument passed to save_handler
; in the case of files, this is the
; path where data files are stored
session.use_cookies = 1 ; whether to use cookies
session.name = PHPSESSID
; name of the session
; is used as cookie name
session.auto_start = 0 ; initialize session on request startup
session.cookie_lifetime = 0 ; lifetime in seconds of cookie
; or if 0, until browser is restarted
session.cookie_path = / ; the path the cookie is valid for
session.cookie_domain = ; the domain the cookie is valid for
session.serialize_handler = php ; handler used to serialize data
; php is the standard serializer of PHP
session.gc_probability = 1 ; percentual 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
session.referer_check = ; check HTTP Referer to invalidate
; externally stored URLs containing ids
session.entropy_length = 0 ; how many bytes to read from the file
session.entropy_file = ; specified here to create the session id
; session.entropy_length = 16
; session.entropy_file = /dev/urandom
session.cache_limiter = nocache ; set to {nocache,private,public} to
; determine HTTP caching aspects
session.cache_expire = 180 ; document expires after n minutes
session.use_trans_sid = 1 ; use transient sid support if enabled
; by compiling with --enable-trans-sid
url_rewriter.tags = "a=href,area=href,frame=src,input=src,form=fakeentry"
Posted: Fri Oct 03, 2003 8:25 am
by maldar
for security reason it can be off (from php 4.2 it is default setting): register_globals=Off
note that $_SESSION is a global variables
ofcourse Note that you are using php 4.0.5 and $_SESSION Introduced in 4.1.0. In earlier versions,you must use $HTTP_SESSION_VARS.
Posted: Fri Oct 03, 2003 10:28 am
by JAM
maldar wrote:you must use session_start() at the beginnig of every page you want use session variables.
try this $_SESSION[test] NOT $_SESSION['test']
Just a note. The above is not entirely correct. It depends on if and where the other quotes reside. If your error_level is bumbed to max, you'll get errors trying to echo $_SESSION[test] without quotes.
Code: Select all
$_SESSION['test'] = 1;
echo $_SESSION['test'];
mysql_query("select * from table where id = $_SESSION[test]");
Posted: Mon Oct 06, 2003 4:39 am
by maldar
Thanks to Jam and his good note

Posted: Mon Oct 06, 2003 8:30 am
by digihoo
yaron,
have a look at your "phpinfo.php" page and make sure that Session Support is enabled.
Posted: Mon Oct 06, 2003 11:49 am
by Stoneguard
Yaron,
What operating system and web server are you using?
Under Windows 2000+ you must give the anonymous user id the proper security level to write out session information to the path you have specified for writing sessions. Typically, the anonymous user is IUSR_<compname>
Posted: Mon Feb 23, 2004 3:14 pm
by Magosoft
Stoneguard wrote:Yaron,
What operating system and web server are you using?
Under Windows 2000+ you must give the anonymous user id the proper security level to write out session information to the path you have specified for writing sessions. Typically, the anonymous user is IUSR_<compname>
I have the same problem.
I'm developing with Apache 1.3.X and php-4.3.4,
under Windows 2000 professional.
In my php.ini file I had set the session_path="C:\php\sessions"
when I start the session with:
<?php
session_start();
$_SESSION['myvar]='Some string';
echo '<a href="test.php">Test</a>';
?>
This creates a file with the name:
sess_56#######.....etc.
When I edit it is says:
myvar|s:11:"Some string"
However, when I hit the Test link on my page
the value does not exists in the new page, and
it creates me a new session file in the session folder.
The code for the test.php file is:
<?php
session_start();
echo $_SESSION['myvar'];
?>
Any help will be appreciated.
MAGO