PHP and cwd/chdir in a threaded environment

From: Date: Tue, 23 Nov 1999 21:13:15 +0000
Subject: PHP and cwd/chdir in a threaded environment
Groups: php.version4 
Request: Send a blank email to php-version4+get-6765@lists.php.net to get a copy of this message
Heya again. I see another potential problem with using PHP in a threaded environment - chdir is generally a nono. They are not thread-local but process global. Even though my current php implementation is run in a serial manner (the PHP module has a lock in it), Roxen wouldn't like getting the current directory being changed. This cause two problems: 1) PHP scripts expect CWD to be the current directory. inserts wouldn't work unless the complete path is used. 2) chdir from a PHP script would (could) mess up Roxen. My suggestion is to use a "virtual" file system model in PHP. Ie, have the "cwd" be a variable in the of the script global structs. Every time you open a file with a relative path use the "cwd" from that structure as the base directory. It should really be a rather easy thing to implement since it doesn't affect that many functions. -- [ Below is a random fortune, which is unrelated to the above message. ] Computer programs expand so as to fill the core available.

« previous php.version4 (#6765) next »