Problem handling session on php4

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
tebota
Forum Newbie
Posts: 1
Joined: Tue Jun 16, 2009 6:17 pm

Problem handling session on php4

Post by tebota »

I'm developing a site on Win server 2003 machine with php4. I need to use sessions and pass variables relateds with it.
Reading across de net, I found that the way to do it was through session_start() (right from the index page and the rest of the pages) and $_SESSION['varname']. I did it, but appears a warning message:

Warning: open(/tmp\sess_5143b96f9480a9420e130d0f8aabac5d, O_RDWR) failed: No such file or directory (2) in d:\utamed2\portafolio\main.php on line 2

on every single page that contains the session_start() function (I wrote it at the very top of the page), and don't call $_SESSION['varname'] until someone log in.

Reading again (uf) i found that the error was that the tmp folder wasn't phisically created. I created it and change the path on php.ini to it, restarted http server, but the error was (and IS) still there even in the index page where is the log in formulary. The funny thing is that when I checked the /tmp folder, the file was there and I found a file called 5143b96f9480a9420e130d0f8aabac5d, but the warning says that it doesn't exists. My site it isn't on the root directory, if you wanna take a look try http://146.83.102.237/utamed2/portafolio/index.php

What it can be? I include the session section of the php.ini

; 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 = 1

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

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

; 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 = /

; The domain for which the cookie is valid.
session.cookie_domain =

; 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.
; HTTP_REFERER has to contain this substring for the session to be
; considered as valid.
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

; Set to {nocache,private,public} to determine HTTP caching aspects.
session.cache_limiter = nocache

; Document expires after n minutes.
session.cache_expire = 240

; use transient sid support if enabled by compiling with --enable-trans-sid.
session.use_trans_sid = 1

url_rewriter.tags = "a=href,area=href,frame=src,input=src,form=fakeentry"

Txs for advance for the responses
User avatar
McInfo
DevNet Resident
Posts: 1532
Joined: Wed Apr 01, 2009 1:31 pm

Re: Problem handling session on php4

Post by McInfo »

Try changing your session.save_path to something like

Code: Select all

session.save_path = "C:\tmp"
Edit: This post was recovered from search engine cache.
Last edited by McInfo on Tue Jun 15, 2010 11:21 pm, edited 1 time in total.
User avatar
yacahuma
Forum Regular
Posts: 870
Joined: Sun Jul 01, 2007 7:11 am

Re: Problem handling session on php4

Post by yacahuma »

please consider php5. There is not reason to keep using php4.
Post Reply