#25968 [Bgs]: $_SERVER['REQUEST_URI'] - Undefined index
| From: | bob at rsi dot com | Date: | Fri, 31 Oct 2003 17:06:19 +0000 |
| Subject: | #25968 [Bgs]: $_SERVER['REQUEST_URI'] - Undefined index | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-49782@lists.php.net to get a copy of this message | ||
ID: 25968
User updated by: bob at rsi dot com
Reported By: bob at rsi dot com
Status: Bogus
Bug Type: CGI related
Operating System: W2K Server - SP3
PHP Version: 4.3.3
New Comment:
The answer to this bug appears to be that IIS is not setting
REQUEST_URI in the environment for PHP under CGI mode.
The above comment about looking in php.ini for clues appears to be
incorrect guidance.
Better off to start reading here:
http://php.net/reserved.variables
http://hoohoo.ncsa.uiuc.edu/cgi/env.html
http://php.net/manual/en/function.getenv.php
http://php.net/manual/en/function.phpinfo.php
phpinfo(INFO_ENVIRONMENT);
And here is a code snippet work around:
// Work around REQUEST_URI bug under W2K/IIS/CGI/PHP
if (!isset($_SERVER['REQUEST_URI']) and isset($_SERVER['SCRIPT_NAME']))
{
$_SERVER['REQUEST_URI'] = $_SERVER['SCRIPT_NAME'];
if (isset($_SERVER['QUERY_STRING']) and
!empty($_SERVER['QUERY_STRING']))
$_SERVER['REQUEST_URI'] .= '?' . $_SERVER['QUERY_STRING'];
}
Previous Comments:
------------------------------------------------------------------------
[2003-10-30 20:47:39] sniper@php.net
See the php.ini-dist for all the cgi. prefixed options
and tune those. This is not a bug.
------------------------------------------------------------------------
[2003-10-24 09:15:07] bob at rsi dot com
System = Windows NT 5.0 build 2195
Build Date = Aug 24 2003 22:01:16
Server API = CGI/FastCGI
PHP API = 20020918
PHP Extension = 20020429
Zend Extension = 20021010
Debug Build = no
Thread Safety = enabled
------------------------------------------------------------------------
[2003-10-23 22:13:19] iliaa@php.net
What sapi are you using?
------------------------------------------------------------------------
[2003-10-23 10:43:35] bob at rsi dot com
Description:
------------
Somewhere between PHP4.2.3 and PHP 4.3.1 REQUEST_URI disappeared.
Reproduce code:
---------------
echo $_SERVER['REQUEST_URI'];
Expected result:
----------------
echo _SERVER['SCRIPT_NAME'] . '?' . _SERVER['QUERY_STRING'];
Actual result:
--------------
Notice: Undefined index: REQUEST_URI in ...
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=25968&edit=1