As stated, when I run a direct PHP script like so:
# /usr/bin/php path/to/script.php
I am able to use environment variables
But when I have this script running from cron:
* * * * * /usr/bin/php path/to/script.php
The script runs but all my environment variables are null.
How do I simulate the CLI via the cron?
(on centOS / linux)
You can write a script which sets the environment variables you want to be present:
and then invoke that script from cron instead.