#18657 [Opn->Csd]: CLI version: scriptname is only available through argv

From: Date: Sat, 10 Aug 2002 22:47:00 +0000
Subject: #18657 [Opn->Csd]: CLI version: scriptname is only available through argv
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-16464@lists.php.net to get a copy of this message
ID: 18657 Updated by: helly@php.net Reported By: cmv@php.net -Status: Open +Status: Closed Bug Type: Feature/Change Request Operating System: Linux 2.4 PHP Version: 4.2.2 -Assigned To: +Assigned To: helly New Comment: This bug has been fixed in CVS. You can grab a snapshot of the CVS version at http://snaps.php.net/. In case this was a documentation problem, the fix will show up soon at http://www.php.net/manual/. In case this was a PHP.net website problem, the change will show up on the PHP.net site and on the mirror sites. Thank you for the report, and for helping us make PHP better. All file relevant variables are now available by $_SERVER. PHP_SELF filename or '-' for stdin SCRIPT_NAME filename or '-' for stdin SCRIPT_FILENAME filename or '' for stdin PATH_TRANSLATED or '' for stdin DOCUMENT_ROOT allways '' Previous Comments: ------------------------------------------------------------------------ [2002-08-03 09:21:48] helly@php.net But it would make sense AND the incase of CLI why not treat SHELL as SERVER? ------------------------------------------------------------------------ [2002-07-30 16:01:49] rasmus@php.net Would be a bit odd to have any $_SERVER variables in the cli version as there is no server. ------------------------------------------------------------------------ [2002-07-30 15:59:22] cmv@php.net With the CLI version, the only way to access the script name is through: $_SERVER['argv'][0] In 4.2.2, $_SERVER['PHP_SELF'] is set, but empty. In 4.3.0-dev, it's not even set. I don't know which of $_SERVER['SCRIPT_NAME'] or $_SERVER['PHP_SELF'] would be more appropriate, but I think setting either of those to the script name would be more intuitive, and might make porting web-based scripts to CLI-based scripts easier. - Colin ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=18657&edit=1

« previous php.bugs (#16464) next »