CodeIgniter Forums
CLI vs. 'normal' environment differences? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24)
+--- Thread: CLI vs. 'normal' environment differences? (/showthread.php?tid=80953)



CLI vs. 'normal' environment differences? - gazer - 01-06-2022

What differences do I need to consider when running a function from command line (CLI) vs. calling it from a browser?
I'm trying get a function running from cron (it's a website scrape using Goutte/Symfony libraries) - it works when called from a browser, but fails (at 338 iterations every time) when attempted via php index.php.
Might there be something missing that I could add to the CLI environment to enable it to not fail?
Thanks.


RE: CLI vs. 'normal' environment differences? - kenjis - 01-06-2022

Why don't you run it via CLI?

$ php public/index.php home index


RE: CLI vs. 'normal' environment differences? - gazer - 01-06-2022

(01-06-2022, 05:07 PM)kenjis Wrote: Why don't you run it via CLI?

$ php public/index.php home index

Exactly - it's failing from CLI while working from a browser call.

I think I figured out the immediate issue: apparent speed of CLI is clogging my httpclient calls.  Fixed that.

Still, when I run from CLI, none of my log_message statements make it to the log, so there must be some environment differences I'm missing.

Thanks.


RE: CLI vs. 'normal' environment differences? - kilishan - 01-07-2022

The CLI version of PHP is quite often a different install than the one used on the web server with its own ini files, etc. I'd double check the setup of your CLI based PHP that it's running.