Re: [PHP-DEV] Re: Current working directory and multi-threaded environments From: Andi Gutmans (andi <email protected>)
Date: 03/16/00

It seems that the cwd framework Sascha and I have written is pretty close
to being what we need.
 From doing a few greps on the source tree (for chdir()) we need to also
add a function which "virtually" does the same as apache's chdir_filename().
The same kind of functionality was added in php4isapi.c, the code from
there is:

                 char *path_end = strrchr(SG(request_info).path_translated,
'\\');

                 if (path_end) {
                         *path_end = 0;
                         chdir(SG(request_info).path_translated);
                         *path_end = '\\';
                 }

Basically what it does, it takes the whole filepath as an argument and
chdir()'s to the path minus the filename. The Apache version does pretty
much the same although it chdir()'s to the whole path in case there is no
filename (no idea if this can ever happen).

I think what remains to be implemented is:
virtual_chdir_filepath()
virtual_expand_filepath() - Just need to split the main function into two.

Anyone else see some other work which needs to be done?
The way I see us integrating this is to have sapi_startup() call getcwd()
and store it in a true global and then duplicate it per-request first thing.

Andi

---
Andi Gutmans <andi <email protected>>
http://www.zend.com/

-- PHP Development Mailing List <http://www.php.net/> To unsubscribe, e-mail: php-dev-unsubscribe <email protected> For additional commands, e-mail: php-dev-help <email protected> To contact the list administrators, e-mail: php-list-admin <email protected>