RE: this line throws up an undefined index.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Ross wrote:
> <? $filename = basename($_SERVER['SCRIPT_FILENAME']);
> $link= "../text_only/$filename";
> ?>
>
>
> any ideas how to prevent this error?

>From the PHP Documentation:
"$_SERVER is an array containing information such as headers, paths, and
script locations. The entries in this array are created by the webserver.
There is no guarantee that every webserver will provide any of these;
servers may omit some, or provide others not listed here. That said, a large
number of these variables are accounted for in the » CGI 1.1 specification,
so you should be able to expect those. "

If you are executing a script on the command line it will not exist.

Try using argc and argv for that. The filename is typically argv[0].

isset($_SERVER['SCRIPT_FILENAME']) will return true if the index exist.

Albert

-- 
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.375 / Virus Database: 267.14.23/243 - Release Date: 2006/01/27
 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux