|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #44777 PHP ISAPI random working dir only in Root of website
Submitted: 2008-04-18 14:44 UTC Modified: 2008-10-21 11:29 UTC
Avg. Score:5.0 ± 0.0
Reproduced:4 of 4 (100.0%)
Same Version:3 (75.0%)
Same OS:4 (100.0%)
From: toby at simmonsconsulting dot com Assigned:
Status: Not a bug Package: IIS related
PHP Version: 5.2.5 OS: Windows 2003 Server
Private report: No CVE-ID: None
 [2008-04-18 14:44 UTC] toby at simmonsconsulting dot com
PHP ISAPI under IIS 6.x (Windows 2003 Server) reports an inconsistent working directory ONLY in the root of a web site. The working directory is perfectly consistent when checked in a subdirectory of a web site.

I have seen similar bugs reported but they were either BOGUS or no longer open. I understand ISAPI is unstable (according to Bug #42460) but this bug only seems to occur in the root of a web site.

Say the root of your web site is D:\websites\testsite.

If you create a php file with the following code:

  echo getcwd()."<br />\n";

and place it in the above directory then load it (http://testsite/cwd.php), loading will produce a random directory. If you place this file in a subdirectory, say D:\websites\testsite\testdir, and load the page (from the new location, http://testsite/testdir/cwd.php) it will produce the expected results: D:\websites\testsite\testdir.

Reproduce code:
  echo getcwd()."<br />\n";

Expected result:
In the root folder of your website (say, D:\websites\testsite) you would expect D:\websites\testsite.

In a subdirectory of your website (say, D:\websites\testsite\testdir) you would expect just that, D:\websites\testsite\testdir.

Actual result:
In the root folder of your website (say, D:\websites\testsite) you get random results, anything from C:\WINDOWS\System32 to various subdirectories in your website (or other websites if you host more than one.)

In a subdirectory of your website (say, D:\websites\testsite\testdir) it seems to work fine.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2008-04-18 14:49 UTC] toby at simmonsconsulting dot com
FYI, PHP CGI/FastCGI does not have this problem.
 [2008-06-04 19:30 UTC] asset at impactdamage dot com
I am having this same issue, however I get this when using either ISAPI or FASTCGI.

It can be resolved by giving list folder permissions on the parent folder.  I cant seem to find a workaround to this, as in a shared environment I dont want to give list permissions on the parent.
 [2008-06-09 20:59 UTC] don dot lebert at crystaltech dot com
I too am still having this problem which was originally posted here:
 [2008-10-21 11:29 UTC]
We are aware of PHP's problems with stability under IIS and are working 
to rectify the problem. Unfortunatly your bug report does not contain any
extra useful information and we already have enough bug reports open about
this issue. If you can provide more detailed information such as a 
reproducable crash or a backtrace please do so and reopen this bug. 
Otherwise please keep trying new releases as we are working to resolve 
the problems on this platform
Thanks for your interest in PHP.

PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Jul 14 17:01:28 2024 UTC