#38820 [NEW]: chdir(".") and chdir("..") don't work with Apache 2.0+

Ask a Question related to PHP Bugs, Design and Development.

  1. #1

    Default #38820 [NEW]: chdir(".") and chdir("..") don't work with Apache 2.0+

    From: ras at fyn dot dk
    Operating system: Win XP SP2
    PHP version: 5.1.6
    PHP Bug Type: Directory function related
    Bug description: chdir(".") and chdir("..") don't work with Apache 2.0+

    Description:
    ------------
    When using chdir() with relative folders (e.g. "." and ".."), under Apache
    2.0 or newer, using either the php5 module or the CGI binary, the function
    changes the current directory to the Apache application folder, rather
    than a folder relative to the current folder.

    Tested with PHP 5.1.6, and current 5.2.x-dev, under Apache 2.2.3, 2.0.59
    and 2.0.55 - all tested with both the php5 module and the CGI binary, all
    with same result.

    Bug appears to be specific to the Windows port of PHP.

    Apache 1.3.37 exhibits no similar problems.

    I filed this bug with Apache, but Ruediger Pluem at apache.org says that
    "this is clearly a PHP bug":

    [url]http://issues.apache.org/bugzilla/show_bug.cgi?id=40496[/url]


    Reproduce code:
    ---------------
    // create the "test" folder before running the script!

    echo getcwd() . "<br />";
    chdir("test");
    echo getcwd() . "<br />";
    chdir("..");
    echo getcwd() . "<br />";
    chdir("..");
    echo getcwd();


    Expected result:
    ----------------
    C:\Web
    C:\Web\test
    C:\Web
    C:\


    Actual result:
    --------------
    C:\Web
    C:\Web\test
    C:\Programmer\Apache Group
    C:\Programmer\Apache Group


    --
    Edit bug report at [url]http://bugs.php.net/?id=38820&edit=1[/url]
    --
    Try a CVS snapshot (PHP 4.4): [url]http://bugs.php.net/fix.php?id=38820&r=trysnapshot44[/url]
    Try a CVS snapshot (PHP 5.2): [url]http://bugs.php.net/fix.php?id=38820&r=trysnapshot52[/url]
    Try a CVS snapshot (PHP 6.0): [url]http://bugs.php.net/fix.php?id=38820&r=trysnapshot60[/url]
    Fixed in CVS: [url]http://bugs.php.net/fix.php?id=38820&r=fixedcvs[/url]
    Fixed in release: [url]http://bugs.php.net/fix.php?id=38820&r=alreadyfixed[/url]
    Need backtrace: [url]http://bugs.php.net/fix.php?id=38820&r=needtrace[/url]
    Need Reproduce Script: [url]http://bugs.php.net/fix.php?id=38820&r=needscript[/url]
    Try newer version: [url]http://bugs.php.net/fix.php?id=38820&r=oldversion[/url]
    Not developer issue: [url]http://bugs.php.net/fix.php?id=38820&r=support[/url]
    Expected behavior: [url]http://bugs.php.net/fix.php?id=38820&r=notwrong[/url]
    Not enough info: [url]http://bugs.php.net/fix.php?id=38820&r=notenoughinfo[/url]
    Submitted twice: [url]http://bugs.php.net/fix.php?id=38820&r=submittedtwice[/url]
    register_globals: [url]http://bugs.php.net/fix.php?id=38820&r=globals[/url]
    PHP 3 support discontinued: [url]http://bugs.php.net/fix.php?id=38820&r=php3[/url]
    Daylight Savings: [url]http://bugs.php.net/fix.php?id=38820&r=dst[/url]
    IIS Stability: [url]http://bugs.php.net/fix.php?id=38820&r=isapi[/url]
    Install GNU Sed: [url]http://bugs.php.net/fix.php?id=38820&r=gnused[/url]
    Floating point limitations: [url]http://bugs.php.net/fix.php?id=38820&r=float[/url]
    No Zend Extensions: [url]http://bugs.php.net/fix.php?id=38820&r=nozend[/url]
    MySQL Configuration Error: [url]http://bugs.php.net/fix.php?id=38820&r=mysqlcfg[/url]
    ras at fyn dot dk Guest

  2. Similar Questions and Discussions

    1. #28327 [Com]: chdir("..") not working in PHP5 on WinNT4
      ID: 28327 Comment by: ras at fyn dot dk Reported By: zajdee at seznam dot cz Status: No Feedback Bug Type: ...
    2. CFINPUT type="radio" w/ "value" requires "label"
      On a Flash form, when you specify type='radio' and value='whatever', the value of the 'value' attribute will be displayed as a label if no 'label'...
    3. FScommand("Exec","myapplication.exe") doesnot work on Trial version MX?
      i think projector in this case is meant to be a .exe file not a test.swf like you mentioned. goto File, Publish Settings... and there under the...
    4. "wrong argument type nil (expected String)" from Dir.chdir
      I'm running Ruby 1.6.8. Can anybody tell me why this line: Dir.chdir("/") results in the error "wrong argument type nil (expected String)"...
    5. How to make the "search text" feature work with non "txt" file
      On Fri, 27 Jun 2003 07:19:23 -0700, "Juergen" <anhorn@bktel.com> wrote: See MVP Doug Knox' comments and fix here:...
  3. #2

    Default #38820 [Opn->Fbk]: chdir(".") and chdir("..") don't work with Apache 2.0+

    ID: 38820
    Updated by: [email]tony2001@php.net[/email]
    Reported By: ras at fyn dot dk
    -Status: Open
    +Status: Feedback
    Bug Type: Directory function related
    Operating System: Win XP SP2
    PHP Version: 5.1.6
    New Comment:

    Please try using this CVS snapshot:

    [url]http://snaps.php.net/php5.2-latest.tar.gz[/url]

    For Windows:

    [url]http://snaps.php.net/win32/php5.2-win32-latest.zip[/url]




    Previous Comments:
    ------------------------------------------------------------------------

    [2006-09-14 06:40:02] ras at fyn dot dk

    Description:
    ------------
    When using chdir() with relative folders (e.g. "." and ".."), under
    Apache 2.0 or newer, using either the php5 module or the CGI binary,
    the function changes the current directory to the Apache application
    folder, rather than a folder relative to the current folder.

    Tested with PHP 5.1.6, and current 5.2.x-dev, under Apache 2.2.3,
    2.0.59 and 2.0.55 - all tested with both the php5 module and the CGI
    binary, all with same result.

    Bug appears to be specific to the Windows port of PHP.

    Apache 1.3.37 exhibits no similar problems.

    I filed this bug with Apache, but Ruediger Pluem at apache.org says
    that "this is clearly a PHP bug":

    [url]http://issues.apache.org/bugzilla/show_bug.cgi?id=40496[/url]


    Reproduce code:
    ---------------
    // create the "test" folder before running the script!

    echo getcwd() . "<br />";
    chdir("test");
    echo getcwd() . "<br />";
    chdir("..");
    echo getcwd() . "<br />";
    chdir("..");
    echo getcwd();


    Expected result:
    ----------------
    C:\Web
    C:\Web\test
    C:\Web
    C:\


    Actual result:
    --------------
    C:\Web
    C:\Web\test
    C:\Programmer\Apache Group
    C:\Programmer\Apache Group



    ------------------------------------------------------------------------


    --
    Edit this bug report at [url]http://bugs.php.net/?id=38820&edit=1[/url]
    tony2001@php.net Guest

  4. #3

    Default #38820 [Fbk->Opn]: chdir(".") and chdir("..") don't work with Apache 2.0+

    ID: 38820
    User updated by: ras at fyn dot dk
    Reported By: ras at fyn dot dk
    -Status: Feedback
    +Status: Open
    Bug Type: Directory function related
    Operating System: Win XP SP2
    PHP Version: 5.1.6
    New Comment:

    Tony, as said - I already tried the current snapshot, downloaded the
    latest development release yesterday.

    Unless it was fixed and updated today, I'm sorry, but I don't have time
    to uninstall, reinstall and reconfigure Apache and PHP again just now.
    My current Apache 1.3 installation works just fine for me - I only use
    the Windows release for testing and development on my workstation...


    Previous Comments:
    ------------------------------------------------------------------------

    [2006-09-14 08:50:01] [email]tony2001@php.net[/email]

    Please try using this CVS snapshot:

    [url]http://snaps.php.net/php5.2-latest.tar.gz[/url]

    For Windows:

    [url]http://snaps.php.net/win32/php5.2-win32-latest.zip[/url]



    ------------------------------------------------------------------------

    [2006-09-14 06:40:02] ras at fyn dot dk

    Description:
    ------------
    When using chdir() with relative folders (e.g. "." and ".."), under
    Apache 2.0 or newer, using either the php5 module or the CGI binary,
    the function changes the current directory to the Apache application
    folder, rather than a folder relative to the current folder.

    Tested with PHP 5.1.6, and current 5.2.x-dev, under Apache 2.2.3,
    2.0.59 and 2.0.55 - all tested with both the php5 module and the CGI
    binary, all with same result.

    Bug appears to be specific to the Windows port of PHP.

    Apache 1.3.37 exhibits no similar problems.

    I filed this bug with Apache, but Ruediger Pluem at apache.org says
    that "this is clearly a PHP bug":

    [url]http://issues.apache.org/bugzilla/show_bug.cgi?id=40496[/url]


    Reproduce code:
    ---------------
    // create the "test" folder before running the script!

    echo getcwd() . "<br />";
    chdir("test");
    echo getcwd() . "<br />";
    chdir("..");
    echo getcwd() . "<br />";
    chdir("..");
    echo getcwd();


    Expected result:
    ----------------
    C:\Web
    C:\Web\test
    C:\Web
    C:\


    Actual result:
    --------------
    C:\Web
    C:\Web\test
    C:\Programmer\Apache Group
    C:\Programmer\Apache Group



    ------------------------------------------------------------------------


    --
    Edit this bug report at [url]http://bugs.php.net/?id=38820&edit=1[/url]
    ras at fyn dot dk Guest

  5. #4

    Default #38820 [Opn]: chdir(".") and chdir("..") don't work with Apache 2.0+

    ID: 38820
    Updated by: [email]tony2001@php.net[/email]
    Reported By: ras at fyn dot dk
    Status: Open
    Bug Type: Directory function related
    Operating System: Win XP SP2
    PHP Version: 5.1.6
    New Comment:

    Not reproducible on Linux with Apache2.0.55 worker/prefork.


    Previous Comments:
    ------------------------------------------------------------------------

    [2006-09-14 11:21:56] ras at fyn dot dk

    Tony, as said - I already tried the current snapshot, downloaded the
    latest development release yesterday.

    Unless it was fixed and updated today, I'm sorry, but I don't have time
    to uninstall, reinstall and reconfigure Apache and PHP again just now.
    My current Apache 1.3 installation works just fine for me - I only use
    the Windows release for testing and development on my workstation...

    ------------------------------------------------------------------------

    [2006-09-14 08:50:01] [email]tony2001@php.net[/email]

    Please try using this CVS snapshot:

    [url]http://snaps.php.net/php5.2-latest.tar.gz[/url]

    For Windows:

    [url]http://snaps.php.net/win32/php5.2-win32-latest.zip[/url]



    ------------------------------------------------------------------------

    [2006-09-14 06:40:02] ras at fyn dot dk

    Description:
    ------------
    When using chdir() with relative folders (e.g. "." and ".."), under
    Apache 2.0 or newer, using either the php5 module or the CGI binary,
    the function changes the current directory to the Apache application
    folder, rather than a folder relative to the current folder.

    Tested with PHP 5.1.6, and current 5.2.x-dev, under Apache 2.2.3,
    2.0.59 and 2.0.55 - all tested with both the php5 module and the CGI
    binary, all with same result.

    Bug appears to be specific to the Windows port of PHP.

    Apache 1.3.37 exhibits no similar problems.

    I filed this bug with Apache, but Ruediger Pluem at apache.org says
    that "this is clearly a PHP bug":

    [url]http://issues.apache.org/bugzilla/show_bug.cgi?id=40496[/url]


    Reproduce code:
    ---------------
    // create the "test" folder before running the script!

    echo getcwd() . "<br />";
    chdir("test");
    echo getcwd() . "<br />";
    chdir("..");
    echo getcwd() . "<br />";
    chdir("..");
    echo getcwd();


    Expected result:
    ----------------
    C:\Web
    C:\Web\test
    C:\Web
    C:\


    Actual result:
    --------------
    C:\Web
    C:\Web\test
    C:\Programmer\Apache Group
    C:\Programmer\Apache Group



    ------------------------------------------------------------------------


    --
    Edit this bug report at [url]http://bugs.php.net/?id=38820&edit=1[/url]
    tony2001@php.net Guest

  6. #5

    Default #38820 [Opn]: chdir(".") and chdir("..") don't work with Apache 2.0+

    ID: 38820
    User updated by: ras at fyn dot dk
    Reported By: ras at fyn dot dk
    Status: Open
    Bug Type: Directory function related
    Operating System: Win XP SP2
    PHP Version: 5.1.6
    New Comment:

    No, it does not reproduce on Linux, as said, the bug appears to be
    specific to the Windows port.


    Previous Comments:
    ------------------------------------------------------------------------

    [2006-09-25 13:04:23] [email]tony2001@php.net[/email]

    Not reproducible on Linux with Apache2.0.55 worker/prefork.

    ------------------------------------------------------------------------

    [2006-09-14 11:21:56] ras at fyn dot dk

    Tony, as said - I already tried the current snapshot, downloaded the
    latest development release yesterday.

    Unless it was fixed and updated today, I'm sorry, but I don't have time
    to uninstall, reinstall and reconfigure Apache and PHP again just now.
    My current Apache 1.3 installation works just fine for me - I only use
    the Windows release for testing and development on my workstation...

    ------------------------------------------------------------------------

    [2006-09-14 08:50:01] [email]tony2001@php.net[/email]

    Please try using this CVS snapshot:

    [url]http://snaps.php.net/php5.2-latest.tar.gz[/url]

    For Windows:

    [url]http://snaps.php.net/win32/php5.2-win32-latest.zip[/url]



    ------------------------------------------------------------------------

    [2006-09-14 06:40:02] ras at fyn dot dk

    Description:
    ------------
    When using chdir() with relative folders (e.g. "." and ".."), under
    Apache 2.0 or newer, using either the php5 module or the CGI binary,
    the function changes the current directory to the Apache application
    folder, rather than a folder relative to the current folder.

    Tested with PHP 5.1.6, and current 5.2.x-dev, under Apache 2.2.3,
    2.0.59 and 2.0.55 - all tested with both the php5 module and the CGI
    binary, all with same result.

    Bug appears to be specific to the Windows port of PHP.

    Apache 1.3.37 exhibits no similar problems.

    I filed this bug with Apache, but Ruediger Pluem at apache.org says
    that "this is clearly a PHP bug":

    [url]http://issues.apache.org/bugzilla/show_bug.cgi?id=40496[/url]


    Reproduce code:
    ---------------
    // create the "test" folder before running the script!

    echo getcwd() . "<br />";
    chdir("test");
    echo getcwd() . "<br />";
    chdir("..");
    echo getcwd() . "<br />";
    chdir("..");
    echo getcwd();


    Expected result:
    ----------------
    C:\Web
    C:\Web\test
    C:\Web
    C:\


    Actual result:
    --------------
    C:\Web
    C:\Web\test
    C:\Programmer\Apache Group
    C:\Programmer\Apache Group



    ------------------------------------------------------------------------


    --
    Edit this bug report at [url]http://bugs.php.net/?id=38820&edit=1[/url]
    ras at fyn dot dk Guest

  7. #6

    Default #38820 [Opn->Fbk]: chdir(".") and chdir("..") don't work with Apache 2.0+

    ID: 38820
    Updated by: [email]iliaa@php.net[/email]
    Reported By: ras at fyn dot dk
    -Status: Open
    +Status: Feedback
    Bug Type: Directory function related
    Operating System: Win XP SP2
    PHP Version: 5.1.6
    New Comment:

    Please try using this CVS snapshot:

    [url]http://snaps.php.net/php5.2-latest.tar.gz[/url]

    For Windows:

    [url]http://snaps.php.net/win32/php5.2-win32-latest.zip[/url]




    Previous Comments:
    ------------------------------------------------------------------------

    [2006-09-26 06:19:26] ras at fyn dot dk

    No, it does not reproduce on Linux, as said, the bug appears to be
    specific to the Windows port.

    ------------------------------------------------------------------------

    [2006-09-25 13:04:23] [email]tony2001@php.net[/email]

    Not reproducible on Linux with Apache2.0.55 worker/prefork.

    ------------------------------------------------------------------------

    [2006-09-14 11:21:56] ras at fyn dot dk

    Tony, as said - I already tried the current snapshot, downloaded the
    latest development release yesterday.

    Unless it was fixed and updated today, I'm sorry, but I don't have time
    to uninstall, reinstall and reconfigure Apache and PHP again just now.
    My current Apache 1.3 installation works just fine for me - I only use
    the Windows release for testing and development on my workstation...

    ------------------------------------------------------------------------

    [2006-09-14 08:50:01] [email]tony2001@php.net[/email]

    Please try using this CVS snapshot:

    [url]http://snaps.php.net/php5.2-latest.tar.gz[/url]

    For Windows:

    [url]http://snaps.php.net/win32/php5.2-win32-latest.zip[/url]



    ------------------------------------------------------------------------

    [2006-09-14 06:40:02] ras at fyn dot dk

    Description:
    ------------
    When using chdir() with relative folders (e.g. "." and ".."), under
    Apache 2.0 or newer, using either the php5 module or the CGI binary,
    the function changes the current directory to the Apache application
    folder, rather than a folder relative to the current folder.

    Tested with PHP 5.1.6, and current 5.2.x-dev, under Apache 2.2.3,
    2.0.59 and 2.0.55 - all tested with both the php5 module and the CGI
    binary, all with same result.

    Bug appears to be specific to the Windows port of PHP.

    Apache 1.3.37 exhibits no similar problems.

    I filed this bug with Apache, but Ruediger Pluem at apache.org says
    that "this is clearly a PHP bug":

    [url]http://issues.apache.org/bugzilla/show_bug.cgi?id=40496[/url]


    Reproduce code:
    ---------------
    // create the "test" folder before running the script!

    echo getcwd() . "<br />";
    chdir("test");
    echo getcwd() . "<br />";
    chdir("..");
    echo getcwd() . "<br />";
    chdir("..");
    echo getcwd();


    Expected result:
    ----------------
    C:\Web
    C:\Web\test
    C:\Web
    C:\


    Actual result:
    --------------
    C:\Web
    C:\Web\test
    C:\Programmer\Apache Group
    C:\Programmer\Apache Group



    ------------------------------------------------------------------------


    --
    Edit this bug report at [url]http://bugs.php.net/?id=38820&edit=1[/url]
    iliaa@php.net Guest

  8. #7

    Default #38820 [Fbk->Opn]: chdir(".") and chdir("..") don't work with Apache 2.0+

    ID: 38820
    User updated by: ras at fyn dot dk
    Reported By: ras at fyn dot dk
    -Status: Feedback
    +Status: Open
    Bug Type: Directory function related
    Operating System: Win XP SP2
    PHP Version: 5.1.6
    New Comment:

    Installed under a clean Apache 2.2.3, and it worked!

    Thank you for your fast response! :)

    Should I change the status of this bug, or will an admin do that?


    Previous Comments:
    ------------------------------------------------------------------------

    [2006-09-26 17:30:34] [email]iliaa@php.net[/email]

    Please try using this CVS snapshot:

    [url]http://snaps.php.net/php5.2-latest.tar.gz[/url]

    For Windows:

    [url]http://snaps.php.net/win32/php5.2-win32-latest.zip[/url]



    ------------------------------------------------------------------------

    [2006-09-26 06:19:26] ras at fyn dot dk

    No, it does not reproduce on Linux, as said, the bug appears to be
    specific to the Windows port.

    ------------------------------------------------------------------------

    [2006-09-25 13:04:23] [email]tony2001@php.net[/email]

    Not reproducible on Linux with Apache2.0.55 worker/prefork.

    ------------------------------------------------------------------------

    [2006-09-14 11:21:56] ras at fyn dot dk

    Tony, as said - I already tried the current snapshot, downloaded the
    latest development release yesterday.

    Unless it was fixed and updated today, I'm sorry, but I don't have time
    to uninstall, reinstall and reconfigure Apache and PHP again just now.
    My current Apache 1.3 installation works just fine for me - I only use
    the Windows release for testing and development on my workstation...

    ------------------------------------------------------------------------

    [2006-09-14 08:50:01] [email]tony2001@php.net[/email]

    Please try using this CVS snapshot:

    [url]http://snaps.php.net/php5.2-latest.tar.gz[/url]

    For Windows:

    [url]http://snaps.php.net/win32/php5.2-win32-latest.zip[/url]



    ------------------------------------------------------------------------

    The remainder of the comments for this report are too long. To view
    the rest of the comments, please view the bug report online at
    [url]http://bugs.php.net/38820[/url]

    --
    Edit this bug report at [url]http://bugs.php.net/?id=38820&edit=1[/url]
    ras at fyn dot dk Guest

  9. #8

    Default #38820 [Opn->Csd]: chdir(".") and chdir("..") don't work with Apache 2.0+

    ID: 38820
    Updated by: [email]tony2001@php.net[/email]
    Reported By: ras at fyn dot dk
    -Status: Open
    +Status: Closed
    Bug Type: Directory function related
    Operating System: Win XP SP2
    PHP Version: 5.1.6
    New Comment:

    Fixed -> closed.


    Previous Comments:
    ------------------------------------------------------------------------

    [2006-09-27 07:04:14] ras at fyn dot dk

    Installed under a clean Apache 2.2.3, and it worked!

    Thank you for your fast response! :)

    Should I change the status of this bug, or will an admin do that?

    ------------------------------------------------------------------------

    [2006-09-26 17:30:34] [email]iliaa@php.net[/email]

    Please try using this CVS snapshot:

    [url]http://snaps.php.net/php5.2-latest.tar.gz[/url]

    For Windows:

    [url]http://snaps.php.net/win32/php5.2-win32-latest.zip[/url]



    ------------------------------------------------------------------------

    [2006-09-26 06:19:26] ras at fyn dot dk

    No, it does not reproduce on Linux, as said, the bug appears to be
    specific to the Windows port.

    ------------------------------------------------------------------------

    [2006-09-25 13:04:23] [email]tony2001@php.net[/email]

    Not reproducible on Linux with Apache2.0.55 worker/prefork.

    ------------------------------------------------------------------------

    [2006-09-14 11:21:56] ras at fyn dot dk

    Tony, as said - I already tried the current snapshot, downloaded the
    latest development release yesterday.

    Unless it was fixed and updated today, I'm sorry, but I don't have time
    to uninstall, reinstall and reconfigure Apache and PHP again just now.
    My current Apache 1.3 installation works just fine for me - I only use
    the Windows release for testing and development on my workstation...

    ------------------------------------------------------------------------

    The remainder of the comments for this report are too long. To view
    the rest of the comments, please view the bug report online at
    [url]http://bugs.php.net/38820[/url]

    --
    Edit this bug report at [url]http://bugs.php.net/?id=38820&edit=1[/url]
    tony2001@php.net Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139