php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #31517 (cgi) PHP_SELF not correctly set?
Submitted: 2005-01-12 14:32 UTC Modified: 2005-01-13 04:23 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: yoghoyogho at fastmail dot fm Assigned:
Status: Not a bug Package: CGI/CLI related
PHP Version: 4.3.10 OS: Debian/GNU Linux 2.4.27-1-686-sm
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: yoghoyogho at fastmail dot fm
New email:
PHP Version: OS:

 

 [2005-01-12 14:32 UTC] yoghoyogho at fastmail dot fm
Description:
------------
In accordance with http://bugs.php.net/bug.php?id=13606 and http://www.php.net/manual/en/reserved.variables.php I would expect PHP_SELF to contain test.php/foo.bar. if the script_name is test.php and it called through the browser with:
test.php/foo.bar.

Instead I get /foo.bar. as PHP_SELF.

Cited from http://www.php.net/manual/en/reserved.variables.php:
"For instance, $_SERVER['PHP_SELF'] in a script at the address http://example.com/test.php/foo.bar  would be /test.php/foo.bar."

So the behaviour I see seems to be inconsistens with the docs.

Here's a snippet from my phpinfo:

Configure Command 	 

'../configure' '--prefix=/usr' '--with-regex=php' '--enable-force-cgi-redirect' '--with-config-file-path=/etc/php4/cgi' '--disable-rpath' '--enable-fastcgi' '--enable-memory-limit' '--disable-debug' '--with-layout=GNU' '--with-pear=/usr/share/php' '--enable-calendar' '--enable-sysvsem' '--enable-sysvshm' '--enable-sysvmsg' '--enable-track-vars' '--enable-trans-sid' '--enable-bcmath' '--with-bz2' '--enable-ctype' '--with-db4' '--with-iconv' '--enable-exif' '--enable-filepro' '--enable-ftp' '--with-gettext' '--enable-mbstring' '--with-pcre-regex=/usr' '--enable-shmop' '--enable-sockets' '--enable-wddx' '--disable-xml' '--with-expat-dir=/usr' '--with-xmlrpc' '--enable-yp' '--with-zlib' '--without-pgsql' '--with-kerberos=/usr' '--with-openssl=/usr' '--enable-dbx' '--with-mime-magic=/usr/share/misc/file/magic.mime' '--with-exec-dir=/usr/lib/php4/libexec' '--disable-static' '--without-mm' '--without-mysql' '--without-sybase-ct'

Server API 	CGI/FastCGI
PHP API 	20020918
PHP Extension 	20020429
Zend Extension 	20021010
Debug Build 	no

My question is this:

Is this is a bug or do I do something wrong in the configuration?

TIA

Reproduce code:
---------------
<?php
// this file is called test.php

echo $_SERVER['PHP_SELF'];

?>



Expected result:
----------------
/test.php/foo.bar.

(this result is shown when the script is run like this: test.php/foo.bar.)

Actual result:
--------------
/foo.bar.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-01-13 04:23 UTC] sniper@php.net
Something wrong with the configuration / webserver.
Ask support questions on the appropriate mailing list.

 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Thu Jul 03 00:01:35 2025 UTC