Current working directory and multi-threaded environments

From: Date: Wed, 15 Mar 2000 18:32:43 +0000
Subject: Current working directory and multi-threaded environments
Groups: php.dev 
Request: Send a blank email to php-dev+get-16843@lists.php.net to get a copy of this message
Hi, I want to layout a way to fix the issue of the chdir()'s in PHP which prevents PHP from working properly in multi-threaded environments. The solution will probably include doing one getcwd() on startup and setting a per-request variable with its value. From that point on we'll never use chdir() and getcwd() anymore but something like virtual_chdir() and virtual_getcwd() which will behave the same way but will not really change the current working directory but will adjust the per-request cwd string. Of course, the file opening functions will be changed to use the new functions instead of the original ones and then we should have pretty decent virtual current working directories. Comments? Does anyone have a better solution or see problems with this one? BTW, any idea if Apache changes the current working directory per-request? I'm not sure if I need to do the real getcwd() per-request or if doing it on PHP startup once is good enough. Andi

« previous php.dev (#16843) next »