1

I have an application using Laravel 5.1 and several cron jobs. It's hosted on a centos6 server using PHP 5.6. This app has been running on this server since Friday without any issues and then when I log in to check today, I have many instances of this error logged in my Laravel logs.

production.ERROR: exception 'ErrorException' with message 'Invalid argument supplied for foreach()' in /vendor/symfony/console/Input/ArgvInput.php:279

In addition, all of the cron jobs on the site stopped working. After doing some research on the issue, it was suggested that I set register_argc_argv = On in the ini for php. I have done this, but to no avail. I also updated composer to see if it would correct itself - but again nothing.

Miranda Roberts
  • 341
  • 1
  • 13
  • It's important to make sure you have edited the correct php.ini file for your SAPI and verify that the changes are taking effect. Check [this answer](http://stackoverflow.com/a/33665510/1878262) for help with that part. – Sherif Sep 21 '16 at 15:19
  • Remember that probably your php.ini for cron jobs (CLI) is different than the php.ini used with your server – Curlas Sep 21 '16 at 15:21
  • If this script runs from a cron job, it's most likely running under your CLI binary. You can verify this by looking at the command specified in the cron job. For example, if you use `php somescript.php somearg1 somearg2` then you'll need to check `which php` from the command line to verify which binary that calls from the cron user's `$PATH`. Otherwise, if you see something like `/usr/bin/php somescript.php somearg1 somearg2` when you must verify this is **in fact** your CLI binary by checking `/usr/bin/php -v` from the command line. – Sherif Sep 21 '16 at 15:22
  • If this is a CGI, binary, for example, then `register_argc_argv` has no effect in that SAPI. Those only work under CLI. – Sherif Sep 21 '16 at 15:23
  • 1
    The `which` for that command showed `/usr/local/bin/php` When checking the version, it says PHP 5.6.26 (cli)` So this does appear to be a proper cli binary. – Miranda Roberts Sep 21 '16 at 15:31
  • A bit off the subject, but don't be surprized to have problems while using php for cron-jobs... – рüффп Sep 21 '16 at 16:22

0 Answers0