php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #28327 chdir("..") not working in PHP5 on WinNT4
Submitted: 2004-05-08 14:38 UTC Modified: 2005-02-23 01:00 UTC
Votes:17
Avg. Score:4.6 ± 0.8
Reproduced:15 of 15 (100.0%)
Same Version:8 (53.3%)
Same OS:6 (40.0%)
From: zajdee at seznam dot cz Assigned:
Status: No Feedback Package: Directory function related
PHP Version: 5CVS-2004-05-08 (dev) OS: Windows NT4
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: zajdee at seznam dot cz
New email:
PHP Version: OS:

 

 [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)

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-05-08 15:58 UTC] zajdee at seznam dot cz
I forgot to tell anything about my config:

PHP 5.0.3RC-dev, Apache2, php loaded as module, binaries from snaps.php.net, running on Windows NT4 Server EN
 [2004-05-09 09:31 UTC] vkatragadda at email dot com
did u run this script on [WinNT4 + PHP4]?
 [2004-05-09 14:53 UTC] zajdee at seznam dot cz
Of course, it works fine with Apache2+PHP4.3.6 on the same system...
 [2005-01-26 04:53 UTC] sniper@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php5-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php5-win32-latest.zip


 [2005-01-27 08:15 UTC] zajdee at seznam dot cz
I am not using NT4 anywhere, but will try to set up a virtual machine in VMware to test it.
 [2005-02-15 01:52 UTC] tony2001@php.net
We're still waiting for feedback..
 [2005-02-23 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 [2005-03-10 18:38 UTC] n dot s dot robson at open dot ac dot uk
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_40
 [2005-05-03 14:00 UTC] gemije at gmx dot net
Is there a chance to fix this bug in near future?
 [2006-09-13 11:04 UTC] ras at fyn dot dk
I 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...
 [2006-09-13 11:06 UTC] ras at fyn dot dk
Forgot to mention, I'm using Windows XP SP2. So it is, apparently, not specific to Windows NT.
 [2006-09-13 13:03 UTC] ras at fyn dot dk
Final note, I have just switched to an old Apache release, version 1.3.37, and this works without problems, using latest PHP release, version 5.1.6.

I configured it to run with the "php5apache.dll" module, not the CGI.

The problem seems to occur only with "php5apache2.dll" and "php5apache2_2.dll" under Apache 2.0.x and 2.2.x, respectively. I suppose this might be a bug in Apache, rather than in PHP?
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Apr 16 16:01:28 2024 UTC