Welcome Guest, Not a member yet? Register   Sign In
CLI vs. 'normal' environment differences?
#1

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.
Reply
#2

Why don't you run it via CLI?

$ php public/index.php home index
Reply
#3

(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.
Reply
#4

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.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB