Bug 40496 - PHP5 incompatibility since v2.x
Summary: PHP5 incompatibility since v2.x
Alias: None
Product: Apache httpd-2
Classification: Unclassified
Component: Platform (show other bugs)
Version: 2.2.2
Hardware: Other Windows XP
: P2 critical (vote)
Target Milestone: ---
Assignee: Apache HTTPD Bugs Mailing List
URL: http://bugs.php.net/bug.php?id=28327&...
Depends on:
Reported: 2006-09-13 13:21 UTC by Rasmus Schultz
Modified: 2006-09-13 07:24 UTC (History)
0 users


Note You need to log in before you can comment on or make changes to this bug.
Description Rasmus Schultz 2006-09-13 13:21:30 UTC
The PHP-commands chdir(".") and chdir("..") seem to switch directory relative 
to Apache's application-root, rather than PHP's current working directory.

This occurs with any PHP5-release or snapshot, under any Apache release 2.0.x 
or 2.2.x, both as module and as CGI-binary.

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 />";
echo getcwd() . "<br />";
echo getcwd() . "<br />";
echo getcwd();

I've created the folder "test" next to the "test.php" script. In all
setups, I get the following output:

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

I'm at my wits end - PHP5 under Apache2 simply does not seem to be an
option for Windows users at this point...

Forgot to mention, I'm using Windows XP SP2. So it is, apparently, not
specific to Windows NT.

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.

With the same PHP-release and "php5apache.dll" under Apache 1.x.x, there is no 

I don't have the technical insight to say whether this is a bug in Apache, in 
the php5apache-DLLs, or in PHP itself. But having confirmed that neither the 
DLLs or the CGI-binary work properly under any Apache release after 2.0, and 
that binaries from the same PHP-build work fine under Apache 1.x, it seems 
likely to be Apache.

If someone could please de/confirm this, please - thank you. PHP's bugtracker 
seems to have canned this bug, without comment, over a year ago. I wonder if 
anyone ever looked into it.

The latest releases of phpMyAdmin, for example, rely on chdir("..") - it would 
be nice if these scripts could be used "out of the box" with current Apache and 
PHP releases under Windows...
Comment 1 Ruediger Pluem 2006-09-13 14:24:50 UTC
Sorry but this is clearly a PHP bug. So you need to open a bug there and bug
them for a comment.