Re: Missing Env. Variables when called by AT Scheduler

From: Date: Wed, 08 Oct 2008 12:39:18 +0000
Subject: Re: Missing Env. Variables when called by AT Scheduler
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-281592@lists.php.net to get a copy of this message
JJB wrote:
We regularly send out massive mail blasts to our customers. Recently several mail blasts failed to transmit. After a serious amount of research we found the snippet of code below to be the place where it was breaking down. The issue it seems is that the Environment Variables HOST and SERVER_NAME are sometimes not returning true when executed from the Linux AT scheduler. (using atq commands). doing a php -i from the command line returns the correct values, as does putting in a php info command at the top of the script and opening it from a browser.
I doubt php -i does that at all. $ php -i | grep 'SERVER_NAME' $ $_SERVER['SERVER_NAME'] and $_SERVER['HOST'] are set by web servers, they are not available through php-cli.
It makes sense doesn't it? Since you don't have a server when calling a script using cli and you don't make a request the $_SERVER and $_REQUEST arrays are not available. -- Thodoris

« previous php.general (#281592) next »