Saturday, 24 August 2013

PHP is adding the drive name to the start of all URLs

PHP is adding the drive name to the start of all URLs

Short version: PHP (or Apache??) is appending "C:" to the start of all
relative URLs. How can I make it stop doing this?
Detail: I'm trying to set up an AMP stack by hand on Windows Vista. This
is just for internal use on my home network.
I've installed Apache 2.2, MySQL, and PHP 5.4. Everything's good except
that PHP is appending "C:" to the beginning of every single URL. For
example, even calling php_info() shows that php is adding "C:" to the
start of SCRIPT_PATH and PHP_SELF:
From the PHP Variables section:
Variable Value
------------------------ ---------------
_SERVER["REQUEST_URI"] /test.php
_SERVER["SCRIPT_PATH"] C:/test.php
_SERVER["PHP_SELF"] C:/test.php
Is there some setting I need to change in php.ini to correct this? It's
totally screwing up links, such that I get lots of error messages like
this in my Apache logs:
[error] [client 10.0.0.4] (20023)The given path was above the root path:
Cannot map GET /C:/<rest of the actual path>
I've compared both php.ini and the Apache httpd.conf to the same files for
an XAMPP installation on my laptop (which does not have this problem) and
I cannot see any differences that seem like they would cause such a
phenomenon.
This problem has ocurred with both Apache 2.4 + PHP 5.5 (both compiled
with VC11) and with Apache 2.2 + PHP 5.4 (both compiled with VC9).

No comments:

Post a Comment