|  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
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
Solve the problem:
15 + 26 = ?
Subscribe to this entry?

 [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-2019 The PHP Group
All rights reserved.
Last updated: Thu Oct 17 22:01:27 2019 UTC