|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #2386 $PHP_SELF doesn't handle $PATH_INFO correctly
Submitted: 1999-09-27 02:39 UTC Modified: 2002-06-16 08:58 UTC
From: phpbugs at reuben dot com Assigned:
Status: Not a bug Package: Misbehaving function
PHP Version: 3.0.12 OS: Linux
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: phpbugs at reuben dot com
New email:
PHP Version: OS:


 [1999-09-27 02:39 UTC] phpbugs at reuben dot com
$PHP_SELF should always contain the location of the script itself, correct?  Because if I use a url like this:


then $PHP_SELF contains:


when it *seems* like it should only be:


as the extra path info is being sent *to* the script (as the variable $PATH_INFO) and has nothing to do with where the script is.  If you want to build the full URL again you could use "$PHP_SELF . $PATH_INFO".

Does that make sense?  I couldn't find an official reference for what $PHP_SELF is *supposed* to describe, but it seems like it should just be the script.

- Isaac


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2001-07-22 17:05 UTC]
I have confirmed that PHP does this (even in 4.0.6), but I
don't know if it should be considered a bug or if it should
be changed.
 [2002-06-16 08:58 UTC]
Thank you for taking the time to report a problem with PHP.
Unfortunately, PHP 3 is no longer supported. Please download
the latest version of PHP 4 from

If you are able to reproduce the bug with one of the latest
versions of PHP, please change the PHP version on this bug report
to the version you tested and change the status back to "Open".
Again, thank you for your continued support of PHP.
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Fri Oct 23 11:01:24 2020 UTC