|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2004-05-08 14:38 UTC] zajdee at seznam dot cz
Description:
------------
Hi,
I've found a bug in PHP5 on Windows NT4 operating system. I think it is somewhere in the PHP virtual directory handling, but haven't found more informations yet.
In short -- chdir("..") doesn't work as expected.
It doesn't occur on Windows XP (2000 not checked), but in Windows NT4 when I run the code below I get the wrong results: relative chdir actually takes a webserver root directory as a source for it's change, instead of the current virtual directory (which is what everyone expects).
As the result, lots of scripts don't work (e.g. phpMyAdmin's css/php script, my own scripts that use chdir("..), etc.)
This bug AFAIK does not appear in PHP4.
Reproduce code:
---------------
<?
echo getcwd()."<br/>\n";
echo chdir("../")."<br/>\n";
echo getcwd()."<br/>\n";
?>
Expected result:
----------------
E:\www\dirtest (script own directory)
1 (chdir was successfull)
E:\www (working directory after chdir)
Actual result:
--------------
E:\www\dirtest (script own directory)
1 (chdir was successfull)
D:\Program Files\Apache Group\Apache2 (working directory after chdir -- wrong)
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Tue Oct 28 03:00:02 2025 UTC |
I've just tried the latest build 5.1.0-dev downloaded this afternoon, on an NT4 system, under IIS 4.0, and the bug is still present. This code <?php $dir = getcwd(); echo "CWD: $dir <Br/> Change dir up one level <Br/>"; chdir ("../"); $dir = getcwd(); echo "CWD: $dir "; ?> gave this output CWD: E:\IIS_40\wwwroot\Test1\level2\level3\level4 Change dir up one level CWD: E:\IIS_40I have tried installations from scratch, using all possible combinations of all of the following: - PHP 5.1.6 (latest release) - PHP 5.2.x-dev (latest snapshot) - Apache 2.2.3 (latest release) - Apache 2.0.59 (last stable 2.0 release) - Apache 2.0.55 That is, I've tried both versions of PHP under all three different Apaches. On all six combinations, I've tried configuring Apache to use both "php-cgi.exe", as well as the modules ("php5apache2.dll" and "php5apache2_2.dll", respetively). The test-script I've been using is as follows: echo getcwd() . "<br />"; chdir("test"); echo getcwd() . "<br />"; chdir(".."); echo getcwd() . "<br />"; chdir(".."); echo getcwd(); I've created the folder "test" next to the "test.php" script. In all setups, I get the following output: C:\Web C:\Web\test C:\Programmer\Apache Group C:\Programmer\Apache Group I have configured "php.ini" and "httpd.conf" manually every time, on two occassions using a configuration file written by a friend. All with the same result. I have even tried downloading "WAMPServer" and one or two other out-of-the-box WAMP distributions, all with the same result - they don't work. I'm at my wits end - PHP5 under Apache2 simply does not seem to be an option for Windows users at this point...