2008/12/11 Johannes Schlüter <johan...@php.net>: > On Wed, 2008-12-10 at 15:56 +0000, Richard Quadling wrote: >> I've been playing with the session.save_path=n;path setting. >> >> The documentation says that there is a mod_files.sh file to help >> create the folder structure (which there is). >> >> But this won't run natively on windows. >> >> I've attached this patch below to create a windows variant >> (mod_files.bat) which works quite nicely. > > Can't we use a platform independent PHP version? I assume that PHP > should be installed when using PHP sessions (yeah one might have the > server module -> own fault) > > johannes > >
I suppose there would be a performance hit if the core dealt with it? I would guess that in php-src/ext/session/mod_files.c, a ... mkdir(buf); between lines 117 and 118 ... for (i = 0; i < (int)data->dirdepth; i++) { buf[n++] = *p++; buf[n++] = PHP_DIR_SEPARATOR; } mkdir(buf); memcpy(buf + n, FILE_PREFIX, sizeof(FILE_PREFIX) - 1); n += sizeof(FILE_PREFIX) - 1; should theoretically fix the problem. It only needs to create the folders if it doesn't exist, but mkdir() won't result in a crash if the directory already exists. I don't know if mkdir() is recursive, adding a few more mkdir()'s (before and during the for() loop, should fix that. Of course, being able to call PHP's internal version of mkdir(buf, 0x777, true); would be ideal. I've attached a patch to for both the .BAT and .PHP versions. The PHP version doesn't require any parameters simply because it can easily read the INI file. I suppose doing some checking to make sure the Depth doesn't exceed the number of available characters (depending upon the hash algorithm and the SESS prefix, etc. would be more complete, but ... Richard. -- ----- Richard Quadling Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731 "Standing on the shoulders of some very clever giants!"
-- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php