cron plugin: unexpected return from HOST

32 views
Skip to first unread message

v.

unread,
Oct 15, 2019, 4:50:54 AM10/15/19
to Fat-Free Framework
If I run $this->f3->HOST from a webinterface, I get a different result than running it through a cronjob (using the excellent cron plugin from https://github.com/xfra35/f3-cron).
If I understand correctly cron jobs run through the CLI.

In the webapp HOST will return subsub.subdomain.website.tld
throught the CLI it returns subdomain.website.tld (so without the subsub).
I am trying to understand why this is. Is this expected behaviour?
How could I get the correct path in both cases (without hardcoding it)?

xfra35

unread,
Oct 15, 2019, 7:31:20 AM10/15/19
to Fat-Free Framework
Hi,

In web mode, HOST contains the requested domain.
In CLI mode, HOST contains the machine name (which is the result of the hostname command).

So, AFAIK, you can't avoid hardcoding desired web domains in CLI apps.

In case your machine is hosting one single website though, you could set the machine hostname to match your web domain: sudo hostname my.website.tld

v.

unread,
Oct 15, 2019, 7:52:07 AM10/15/19
to Fat-Free Framework
Thanks xfra35, understood.

Reply all
Reply to author
Forward
0 new messages