Laravel5.2 scheduling: launch does not work with cron job

I had a problem with php artisan: run schedule. I have the following cron work on GoDaddy:

/usr/bin/php /home/usr/framework/artisan schedule:run >> /dev/null 2>&1

Each time I received this error message:

local.ERROR: exception 'ErrorException' with message 'Invalid argument supplied for foreach()' in /home/usr/framework/vendor/symfony/console/Input/ArgvInput.php:286
Stack trace:
#0 /home/usr/framework/vendor/symfony/console/Input/ArgvInput.php(286): Illuminate\Foundation\Bootstrap\HandleExceptions->handleError(2, 'Invalid argumen...', '/home/usr...', 286, Array)
#1 /home/usr/framework/vendor/symfony/console/Application.php(740): Symfony\Component\Console\Input\ArgvInput->hasParameterOption(Array, true)
#2 /home/usr/framework/vendor/symfony/console/Application.php(114): Symfony\Component\Console\Application->configureIO(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#3 /home/usr/framework/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(107): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#4 /home/usr/framework/artisan(35): Illuminate\Foundation\Console\Kernel->handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#5 {main}  

But if I go to the terminal and write this:

php artisan schedule:run

Everything is working fine. I really don't know where I should look for a solution to this. I need your help to solve this problem. Thank.

+4
source share
2 answers

For me, in the cron job, I changed 'php' to 'php-cli -q' and now it works.

So:

* * * * * php-cli -q /home/user/laravel/artisan schedule:run >> /dev/null 2>&1
+2
source

Change the cron job to the following:

* * * * * /usr/local/bin/php /home/user/laravel/artisan schedule:run >> /dev/null 2>&1

I believe your PHP path is incorrect.

0
source

All Articles