Bug->Req #60850 [Opn]: Built in web server does not set $_SERVER['SCRIPT_FILENAME'] when using router
| From: | laruence@php.net | Date: | Tue, 24 Jan 2012 02:56:18 +0000 |
| Subject: | Bug->Req #60850 [Opn]: Built in web server does not set $_SERVER['SCRIPT_FILENAME'] when using router | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-166751@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=60850&edit=1
ID: 60850
Updated by: laruence@php.net
Reported by: dave dot marshall at atstsolutions dot co dot uk
Summary: Built in web server does not set
$_SERVER['SCRIPT_FILENAME'] when using router
Status: Open
-Type: Bug
+Type: Feature/Change Request
Package: Built-in web server
Operating System: Linux/Ubuntu 11.10
PHP Version: 5.4SVN-2012-01-23 (snap)
Block user comment: N
Private report: N
New Comment:
router is a especially script, if we set this as the script_name, what about the
script which router routed to?
Previous Comments:
------------------------------------------------------------------------
[2012-01-23 13:45:31] dave dot marshall at atstsolutions dot co dot uk
Description:
------------
Nothing special done when compiling, just --configure and then make.
If the webserver couldn't do any path translation, $_SERVER['SCRIPT_FILENAME'] is not
populated. If this is desired behaviour, perhaps the documentation should be updated, as existing
software will rely on it.
----
Given the code below in router.php, and starting the web server with a router
> ~/Downloads/php5.4-201201231230/sapi/cli/php -S localhost:8000 router.php
Fetch the root url, NULL returned
> curl localhost:8000
NULL
Given that this variable is documented, I'd expect it to be string(29)
"/home/davem/temp_ws/router.php"
Touching a file called index.php, seems to trick the webserver in to thinking it's done a path
translation for the root url
> touch index.php
> curl localhost:8000
string(29) "/home/davem/temp_ws/index.php"
Test script:
---------------
router.php
<?php
var_dump($_SERVER['SCRIPT_FILENAME']);
return true;
Expected result:
----------------
string(29) "/home/davem/temp_ws/router.php"
Actual result:
--------------
NULL
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=60850&edit=1