#21261 [Com]: $_SERVER['PHP_SELF'] gives wrong info
| From: | shane at caraveo dot com | Date: | Tue, 31 Dec 2002 07:21:50 +0000 |
| Subject: | #21261 [Com]: $_SERVER['PHP_SELF'] gives wrong info | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-28821@lists.php.net to get a copy of this message | ||
ID: 21261
Comment by: shane@caraveo.com
Reported By: undream@yifan.net
Status: Open
Bug Type: Scripting Engine problem
Operating System: linux 2.4.18 - slack 8.1
PHP Version: 4.3.0
New Comment:
Send me the pertinent lines out of httpd.conf that you have used to
configure php so I can test with the same settings.
Previous Comments:
------------------------------------------------------------------------
[2002-12-30 20:21:48] pollita@php.net
Probable cause found.... Checking with submitter of prior patch.
------------------------------------------------------------------------
[2002-12-30 20:21:02] tapken@engter.de
I have a similar problem. It is discribed in
http://bugs.php.net/bug.php?id=21301
The result of set cat be viewed on
http://www.engter.de/shenv.php
------------------------------------------------------------------------
[2002-12-30 10:59:11] undream@yifan.net
'set' alone does not give PATH_INFO but I explicitly
called a few vars. Note that I had to run it from the
cgi-bin dir, but they were the same for php 4.3.0 and
4.2.3:
-----CGI/1.0 test script with cgi php 4.3.0 OR 4.2.3-----
SERVER_SOFTWARE = Apache/1.3.27 (Unix)
SERVER_NAME = localhost.localdomain
GATEWAY_INTERFACE = CGI/1.1
SERVER_PROTOCOL = HTTP/1.1
SERVER_PORT = 80
REQUEST_METHOD = GET
HTTP_ACCEPT = text/*, image/jpeg, image/png, image/*, */*
PATH_INFO =
PATH_TRANSLATED =
SCRIPT_NAME = /cgi-bin/test-cgi
QUERY_STRING =
REMOTE_HOST =
REMOTE_ADDR = 127.0.0.1
REMOTE_USER =
AUTH_TYPE =
CONTENT_TYPE =
CONTENT_LENGTH =
I also posted the phpinfo() fron php cgi 4.2.3 at
http://www.undream.com/php/env-4.2.3.html.
The php_self is
correct there. Nothing else has changed.
I also played around with calling php_info() from various
directories. Sometimes pieces of the php_self path are
hopped, sometimes it is not even set. It is very
consistent. I did not notice any pattern (i.e chopping off
the first x letters everytime)
------------------------------------------------------------------------
[2002-12-29 19:51:28] pollita@php.net
I have a theory, but I need you to run one more test:
1) Create a CGI shell script "/var/www/htdocs/shenv.sh" with the
following content:
#!/bin/sh
set
2) Be sure to chmod it so that it can be executed by the webserver then
browse to it (i.e.: http://localhost/shenv.php )
Post the results here.
My theory is that Apache is not setting the CGI environment variables
"SCRIPT_NAME" or "PATH_INFO" correctly. But I can at least tell you
one thing for sure... The "ocs" in "ocs/env.php" is comming from the
last three characters in the file's true path "/var/www/htdocs/env.php"
------------------------------------------------------------------------
[2002-12-29 14:05:27] undream@yifan.net
A strace dump for the following page content:
<?php
echo $_SERVER['PHP_SELF'];
?>
called from url: http://localhost/test.php can be found
at: http://www.undream.com/php/bug-21261.log
The PHP_SELF result for that one was :PHP/4.3.0
I also have a phpinfo dump of my setup at:
http://www.undream.com/php/env.html
This last one was called using http://localhost/env.php
url. As you can see, the PHP_SELF result is equally weird.
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/21261
--
Edit this bug report at http://bugs.php.net/?id=21261&edit=1