hi
I am using PHP 5.0.4 on OpenSuse 10.x. I have the following piece of
code,
$sp1 = $_SERVER["SCRIPT_FILENAM E"];
$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].
We don't see any error messages on OpenSuse. What could we be doing
wrong? Any pointers are appreciated
B.G. Mahesh 6 1885
*** 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_FILENAM E"];
$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($_SERVE R);
?>
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
--
Alvaro G. Vicario wrote:
*** 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_FILENAM E"];
$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($_SERVE R);
?>
When I run this script from the command line or the web it does show
SCRIPT_FILENAME [with the correct value]. But when the script runs from
cron it is NULL. Is this normal behavior?
-- Mahesh http://www.greynium.com/
BG Mahesh wrote:
Alvaro G. Vicario wrote:
>>*** 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_FILENAM E"];
$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($_SER VER);
?>
When I run this script from the command line or the web it does show
SCRIPT_FILENAME [with the correct value]. But when the script runs from
cron it is NULL. Is this normal behavior?
-- Mahesh http://www.greynium.com/
Is the cron job calling the page through the web server? Or is it just
executing the script?
$_SERVER is filled in by the web server - and it won't exist if you
don't access the page though the server ( http://...).
--
=============== ===
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp. js*******@attgl obal.net
=============== ===
*** Jerry Stuckle escribió/wrote (Mon, 24 Jul 2006 23:16:11 -0400):
$_SERVER is filled in by the web server - and it won't exist if you
don't access the page though the server (http://...).
Not necessarily. I do get quite a large $_SERVER variable when running PHP
from command line. But as manual warns available values may vary.
--
-+ 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
--
When I run this script from the command line or the web it does show
SCRIPT_FILENAME [with the correct value]. But when the script runs from
cron it is NULL. Is this normal behavior?
-- Mahesh http://www.greynium.com/
Is the cron job calling the page through the web server? Or is it just
executing the script?
$_SERVER is filled in by the web server - and it won't exist if you
don't access the page though the server (http://...).
hi
I think I found the problem. On the machine where things work I have
PHP-CLI and the other one that was giving me grief had PHP-CGI.
Where does one find rpms for PHP-5.0.4-CLI [OpenSuse]?
-- Mahesh http://www.oneindia.in/ This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: mr_burns |
last post by:
Hi,
I am using $HTTP_SERVER_VARS to get the name of the
current web page. How do I also get the GET variables using PHP as a
complete string. For example:
'?first=12&second=value&third=2.99'
As I dont know what the variables may I cant simply use $_GET. Ideally
something like FOR EACH $_GET to generate the GET part of the url. Any
|
by: sherryonline |
last post by:
i have a page and i need that page to be called every day at 12:00
that page is going to connect to the database fetch some emails and
will start mailing them how i am goning to do this.
|
by: vagrantbrad |
last post by:
I'm using python 2.4 running on Fedora Core 4. I have written a python
program called ipscan.py that checks the external ip address of my
cable internet connection, and on change, will update the dns records
at my dns provider, zoneedit. So basically, I've setup dynamic dns
using python. Once the ip compare and/or update is complete, I log...
|
by: the.natalie |
last post by:
Hi.
I am a newbie to mysql, cron, and shell scripting, so please bear with
me. I have a script that is used for updating an image directory based
on contents in a database. The script does the following: runs
several queries against different tables in a database; returns several
lists of pictures being used in the database; removes any...
|
by: Robert |
last post by:
I'm getting the dreaded "No input file specified" when I try to invoke PHP
from thttpd (nochroot).
I wrote a C program to dump environment variables before trying to invoke
PHP. I've included the dumped environment variables below.
As you notice in the C program, I've tried both "argv" (i.e., I'm using
a hard link to the program from...
| |
by: Phil |
last post by:
I have a php script that queries some Oracle DB and outputs a single
line of plain text with <brat the end for each query. This is
Apache2, php4.4.8 and Oracle Instant Client 10.1.0.5 all on CentOS 4.4
32bit. Php does run as an Apache SO.
It works perfectly if I just hit the page in a web-browser (output to
browser).
It works *perfectly*...
|
by: Stephen Cattaneo |
last post by:
Hello all,
I am attempting to execute an automated test (written in Python) via
cron. I have to check the HOSTNAME variable as part of the test, oddly
under cron the HOSTNAME environment variable is not in the os.environ
dictionary. I know that cron runs in a subshell that does not have all
of the normally set environment variables. ...
|
by: Cameron Simpson |
last post by:
On 17Aug2008 21:25, John Nagle <nagle@animats.comwrote:
Because $HOSTNAME is a bash specific variable, set by bash but NOT
EXPORTED! Like $0 and a bunch of other "private" variables, subprocesses
do not inherit this value. From "man bash":
Shell Variables
The following variables are set by the shell:
|
by: Karthik Gurusamy |
last post by:
Hi,
I'm working on a cron like functionality for my application.
The outer loops runs continuously waking every x seconds (say x=180,
300, ..).
It needs to know what events in cron has expired and for each event do
the work needed.
It's basically like unix cron or like a calendar application with some
restrictions. The outer loop may...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it. ...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...
| |