ID:               33894
 User updated by:  marcos dot neves at gmail dot com
 Reported By:      marcos dot neves at gmail dot com
-Status:           Bogus
+Status:           Open
 Bug Type:         Feature/Change Request
 Operating System: any
 PHP Version:      5.1.0b3
 New Comment:

$_SERVER['PHP_SELF'] hasn't the same value using php with apache and
php cli.
Run <? echo $_SERVER['PHP_SELF'] ?> in a browser and as command line,
you'll see the difference.

At browser works fine do the follow:

if(__FILE__ == $_SERVER['PHP_SELF']) {
}

but does not work with cli.

Tested with PHP 5.1.0b3 on windows XP


Previous Comments:
------------------------------------------------------------------------

[2005-08-01 13:28:51] [EMAIL PROTECTED]

Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions.  Due to the volume
of reports we can not explain in detail here why your report is not
a bug.  The support channels will be able to provide an explanation
for you.

Thank you for your interest in PHP.

We've PHP_SELF for this.

------------------------------------------------------------------------

[2005-07-27 23:27:50] marcos dot neves at gmail dot com

Description:
------------
Today we have __FILE__ constant, that has the string fileName of the
current scrit. Would be nice a constant __MAIN_FILE__, wich has the
file name of the first requested PHP file.
So would be possible to do things like this, without use of external
library, and is interesting to everyone:

Reproduce code:
---------------
<?

// class File

class Foo {}

if(__MAIN_FILE__ == __FILE__) {
// run some tests and usabe examples with Foo
}

?>

or used to include relative paths to an application, without define
constants

<?

// included script

require_once dirname(__MAIN_FILE__) . DIRECTORY_SEPARATOR .
"path/to/include/file.php";

?>



------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=33894&edit=1

Reply via email to