You are here: Re: Reading SCRIPT_FILENAME thru cron « PHP Programming Language « IT news, forums, messages
Re: Reading SCRIPT_FILENAME thru cron

Posted by Alvaro G. Vicario on 07/24/06 19:47

*** BG Mahesh escribió/wrote (24 Jul 2006 08:23:36 -0700):
> I am using PHP 5.0.4 on OpenSuse 10.x. I have the following piece of
> code,
>
> $sp1 = $_SERVER["SCRIPT_FILENAME"];
>
> $sp1 is set correctly when I execute file.php thru the browser. But
> when I run that script thru cron [as root] $sp1 is always null.
>
> But on Redhat we see that $sp1 has value [when file.php is executed
> thru cron].

From PHP manual:

$_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.

The "webserver" thing is a typo, but it's true that available variables
differ depending on where you execute the script. I suggest you try this
code:

<?

print_r($_SERVER);

?>


It'll tell you what variables you can use.

--
-+ http://alvaro.es - Álvaro G. Vicario - Burgos, Spain
++ Mi sitio sobre programación web: http://bits.demogracia.com
+- Mi web de humor con rayos UVA: http://www.demogracia.com
--

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация