|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #34206 cwd set to server root (?) in __destruct
Submitted: 2005-08-21 19:11 UTC Modified: 2007-08-20 13:38 UTC
Avg. Score:4.5 ± 0.8
Reproduced:11 of 12 (91.7%)
Same Version:4 (36.4%)
Same OS:7 (63.6%)
From: maniac_warlord at web dot de Assigned:
Status: Closed Package: Documentation problem
PHP Version: Irrelevant OS: Irrelevant
Private report: No CVE-ID: None
 [2005-08-21 19:11 UTC] maniac_warlord at web dot de
cwd is set to server root (i guess) instead of called php file's directory in __destruct()

it probably isn't server root (see results), because that would be /www on linux - on windows it is

Reproduce code:
class Foo
    public function bar()
            echo getcwd() . "\n";

    public function __destruct()
$f = new Foo();

Expected result:
Windows XP:

My webhoster's linux:
/www/htdocs/[some number]
/www/htdocs/[some number]

(or whatever directory the file is in)

Actual result:
Windows XP:
D:\Apache\Apache 2

My webhoster's linux:
/www/htdocs/[some number]


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2005-08-26 11:09 UTC]
This really should be documented. Apache(1&2) does the weird
cwd change for some reason.

 [2007-07-30 09:56 UTC] hans dot duedal at gmail dot com
I believe this is what's causing bug:29167, as well.
 [2007-08-20 13:38 UTC]
This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.

Thank you for the report, and for helping us make our documentation better.

"The working directory in the script shutdown phase can be different with some SAPIs (e.g. Apache)."
PHP Copyright © 2001-2018 The PHP Group
All rights reserved.
Last updated: Sun Nov 19 01:31:42 2017 UTC