Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sessions Error: ps_files_cleanup_dir Invalid argument (22) 1

Status
Not open for further replies.

frainbreeze

Technical User
Jul 31, 2003
123
GB
hello

i receive this notice at the top of the page:

Notice: session_start(): ps_files_cleanup_dir: opendir(c:\windows\temp) failed: Invalid argument (22) in D:\WEBSiTES\ImageLibrary\adminedit.php on line 2

but the only thing on line 2 is session_start();

i only get this msg after the form is submitted to update a record in a mysql db. Not always either, only once in a while. if the user refreshes the page, it disappears.

this is for an internal image library/db where users can search for images, and only a few ppl can access certain pages to add/change/delete images & tags. the login/pass is really only in place to prevent users from accessing an admin page directly/bookmarking it and not having to login etc.

at the top of each admin page is:
Code:
<?php 
session_start();
global $permission;
if ($permission=="yes") { 
#then display page
}
else {
echo "You are not authorised to access this page";
}


and the login page is as follows:

Code:
ob_start();
session_start();
if (count ($HTTP_POST_VARS) == 0) {
	#display the login form
}
else 
{
$username=$HTTP_POST_VARS["username"];
$password=$HTTP_POST_VARS["password"];

if ($username=="admin" AND $password=="adminpassword")
{ 
$permission="yes";
}
else {
$permission="no";
}
	$username=$HTTP_POST_VARS["username"];
	session_register("permission");   
	session_register("username");  

	if ($permission=="yes") { 
	#display admin options
        }
        else {
        echo "incorrect username or password";
        }


does anyone know if there is a resolution for this? i've done some googling and the best i can find is heresay that it is a bug in php...


thanks for any help

annie
 
A number of things happens in PHP when you invoke session_start(). See faq434-4908 for more details.

In php.ini, what is the setting of session.save_path, does that directory exist, and does the user as which your web server runs have permission to delete files in that directory?

Want the best answers? Ask the best questions!

TANSTAAFL!!
 
sleipnir214,

the session.save_path was set to c:\windows\temp, but there were several different sets of user permissions on that folder on the webserver. i've now changed the path to a new folder called c:\temp and set the permissions for everyone to full

this seems to have fixed the message that was coming up, but again, since it only came up occasionally in the first place, i'll let you know...

so i guess consider no news, to be good news :)

cheers m8

annie

 
frainbreeze:

<aside>
Good handle!
</aside>

The problem probably cropped up only when PHP fired off its garbage-collection mechanism. This can happen every time a script invokes session_start() or every so often, depending on certain php.ini settings. Again, see faq434-4908, particularly section 1.

Want the best answers? Ask the best questions!

TANSTAAFL!!
 
sleipnir214,

read your faq re: garbage-collection...so now im wondering..

if one were to change the session.gc_probability and the session.gc_divisor so that the calculated quotient is really low (for ex. 2, which is pretty dern low).. that should in theory reduce the chance that the randomly generated number that php creates is LOWER than it(being 2 in this ex)...thereby reducing the overall random number of times that this problem occurs?

hypothetically speaking of course.

annie

p.s. its a free lunch if someone else pays :p

 
<aside>
And what does the person who pays for lunch want in return? The return makes it not free
</aside>

Do you want to lower the chances of this error's occurring, or eliminate the chances of this error's occurring? I personally prefer the latter.

Also, the less often the garbage-collection mechanism fires off, the more garbage that will be lying around on your server's filesystem.

Want the best answers? Ask the best questions!

TANSTAAFL!!
 
sleipnir214

Since i changed the settings/permissions to allow everyone, i havent see the error message come up again. but since This can happen every time a script invokes session_start() or every so often, depending on certain php.ini settings. can you recommend any other settings/references or code that i can implement that will eliminate the chances of this error's occurring?

(bearing in mind its just a simple and pretty basic login just to prevent casual users from accidentally accessing the edit/delete/add records functions)

thanks

p.s. what if you find a lunch in a lost & found box? then is it free? whether or not you'd eat it is a different story...

p.p.s sorry for the delay, other more stressful things took priority over development..
 
Sooner or later, garbage-collection must take place. Either that or the system will halt when the filesystem gets full.


<aside>
That's a found lunch, not a free lunch.
</aside>



Want the best answers? Ask the best questions!

TANSTAAFL!!
 
yes, thank you, i got that much from your FAQ...and i've not changed the divisors etc to affect garbage collection, (so it still takes place as before) all i've done is change the permissions on the sessions folder and make sure the php.ini points to it.

my concern now is if there is anything that i can implement to prevent that error message from showing up again?


thanks

p.s. not that i endorse it, but what if you were to steal a pic-a-nic basket? that'd be a free lunch, surely!
 
alright, cool, thanks :)


..and it'd be a free lunch if you were yogi-bear, and whos to say if you're yogi or not..this makes no sense anymore, who cares its friday, im goin home!

thanks again





 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top