I have developed a console controller in Yii2 for pulling in data and sending emails. My goal is to automate this task with crontab, which I have done using the yii2tech-crontab library. The issue I am experiencing is that the environment variables that I have set inside Apache configuration (inside our ssl.conf) do not apply when running things as the Apache user (say cron), but do work inside any of our website code.
What makes this a bit harder is that the apache user does not have a home directory (so I can't create a .profile), and I am unable to locate any sort of global apache user specific configuration.
One option would be to set these variables inside /etc/environment, however since these are sensitive credentials, I'd rather them not be accessible to other users.
I was able to add these environment variables to my current shell by creating a /etc/apache-environment file that was owned and grouped to apache, and then updating my cron entry to 0 8 * * * . /etc/apache-environment; php yii cron/task but php does not seem to pickup any of these credentials.
I have also tried setting php's variables_order to just load in environment (in case it was getting cleared) but that didn't change anything.
Are there any other options out there? Thanks for any feedback or help!