#39207 [Opn->Bgs]: Some $_SERVER variables are missing when executing php5-cgi from shell
| From: | tony2001@php.net | Date: | Fri, 20 Oct 2006 14:29:02 +0000 |
| Subject: | #39207 [Opn->Bgs]: Some $_SERVER variables are missing when executing php5-cgi from shell | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-103798@lists.php.net to get a copy of this message | ||
ID: 39207
Updated by: tony2001@php.net
Reported By: konradg at irc dot pl
-Status: Open
+Status: Bogus
Bug Type: CGI related
Operating System: Linux 2.6.17.6-amd64, Debian 3.0
PHP Version: 5.1.6
New Comment:
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
Thos variables are populated by the web-server.
Previous Comments:
------------------------------------------------------------------------
[2006-10-20 09:22:41] konradg at irc dot pl
Better reproduce code:
<?
$vars = array ('PHP_SELF', 'SCRIPT_NAME', 'SCRIPT_FILENAME',
'PATH_TRANSLATED', 'DOCUMENT_ROOT');
foreach ($vars as $v) {
echo '_SERVER["'.$v.'"] => '.(isset($_SERVER[$v]) ?
$_SERVER[$v] : '(not set)');
echo "\n";
}
?>
Expected result (from CLI version):
------------------------------------
php5 test.php
_SERVER["PHP_SELF"] => test.php
_SERVER["SCRIPT_NAME"] => test.php
_SERVER["SCRIPT_FILENAME"] => test.php
_SERVER["PATH_TRANSLATED"] => test.php
_SERVER["DOCUMENT_ROOT"] =>
Actual result (FASTCGI version):
---------------------------------
php5-cgi test.php
_SERVER["PHP_SELF"] =>
_SERVER["SCRIPT_NAME"] => (not set)
_SERVER["SCRIPT_FILENAME"] => (not set)
_SERVER["PATH_TRANSLATED"] => (not set)
_SERVER["DOCUMENT_ROOT"] => (not set)
Thanks.
------------------------------------------------------------------------
[2006-10-20 08:14:17] konradg at irc dot pl
Description:
------------
Some $_SERVER variables in fastcgi version (php5-cgi) are missing
_only_ when executing directly from shell command line.
Variables are:
_SERVER["PHP_SELF"] (set but no value)
_SERVER["SCRIPT_NAME"] (not set)
_SERVER["SCRIPT_FILENAME"] (not set)
_SERVER["PATH_TRANSLATED"] (not set)
_SERVER["DOCUMENT_ROOT"] (not set)
These variables _are_ set in CLI version of php5 and when executing
php5-cgi by web server.
Reproduce code:
---------------
echo "<? phpinfo() ?>" > info.php
php5-cgi info.php > info.txt
Expected result:
----------------
_SERVER["PHP_SELF"] => info.php
_SERVER["SCRIPT_NAME"] => info.php
_SERVER["SCRIPT_FILENAME"] => info.php
_SERVER["PATH_TRANSLATED"] => info.php
_SERVER["DOCUMENT_ROOT"] =>
_SERVER["REQUEST_TIME"] => 1161331562
_SERVER["argv"] => Array
(
[0] => info.php
)
_SERVER["argc"] => 1
in output
Actual result:
--------------
_SERVER["PHP_SELF"] => no value
_SERVER["REQUEST_TIME"] => 1161331600
_SERVER["argv"] => Array
_SERVER["argc"] => 1
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=39207&edit=1