Re: [PHP4BETA] PHP and cwd/chdir in a threaded environment
| From: | Rasmus Lerdorf | Date: | Thu, 01 Jan 1970 00:00:00 +0000 |
| Subject: | Re: [PHP4BETA] PHP and cwd/chdir in a threaded environment | ||
| References: | 1 | Groups: | php.version4 |
| Request: | Send a blank email to php-version4+get-6793@lists.php.net to get a copy of this message | ||
> 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.
What about existing scripts that do any sort of system/exec/popen/passthru?
They would break.
I agree that this is probably the best solution and that we need to do
something here, but I don't think we can make this backward compatible to
the user.
-Rasmus