Some $_SERVER parameters missing when accessing PHP script via Cron

Posted by Jakobud on Server Fault See other posts from Server Fault or by Jakobud
Published on 2012-04-10T21:16:06Z Indexed on 2012/04/10 23:32 UTC
Read the original article Hit count: 214

Filed under:
|
|
|

I have a script that I need to run with PHP via cron. The original author of the script made a lot of user of certain $_SERVER parameters (like REQUEST_URI).

But it appears that certain variables don't exist when running PHP via command line or via CRON. For example, there is no request uri, so it makes sense that the REQUEST_URI parameter wouldn't be available.

Is there any way around this other than to completely rewrite the script in order to avoid using special $_SERVER parameters that aren't universally available?

© Server Fault or respective owner

Related posts about apache2

Related posts about php