php artisan schedule:run => 没有计划的命令准备好 运行
php artisan schedule:run => No scheduled commands are ready to run
Laravel/storage/logs/laravel.log
[2020-04-08 10:41:01] staging.ERROR: Invalid argument supplied for foreach() {"exception":"[object] (ErrorException(code: 0): Invalid argument supplied for foreach() at /home/u8614269/laravel/fti-presensi/vendor/symfony/console/Input/ArgvInput.php:246)
[stacktrace]
#0 /home/u8614269/laravel/fti-presensi/vendor/symfony/console/Input/ArgvInput.php(246): Illuminate\Foundation\Bootstrap\HandleExceptions->handleError(2, 'Invalid argumen...', '/home/u8614269/...', 246, Array)
#1 /home/u8614269/laravel/fti-presensi/vendor/symfony/console/Application.php(1060): Symfony\Component\Console\Input\ArgvInput->getFirstArgument()
#2 /home/u8614269/laravel/fti-presensi/vendor/laravel/framework/src/Illuminate/Console/Application.php(84): Symfony\Component\Console\Application->getCommandName(Object(Symfony\Component\Console\Input\ArgvInput))
#3 /home/u8614269/laravel/fti-presensi/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(131): Illuminate\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#4 /home/u8614269/laravel/fti-presensi/artisan(36): Illuminate\Foundation\Console\Kernel->handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#5 {main}
如果输出是这样的:
Running scheduled command: '/opt/alt/php72/usr/bin/php-cgi' 'artisan' command:your-command > '/dev/null' 2>&1
X-Powered-By: PHP/7.2.26
Content-type: text/html; charset=UTF-8
也许问题是/opt/alt/php72/usr/bin/php-cgi
如果您使用使用 PHP 选择器的共享主机,这个 cron 脚本适合我...
* * * * * /opt/alt/php72/usr/bin/php -q -d register_argc_argv=1 /laravel_app_path/artisan schedule:run >> /home/schedule.log 2>&1 &
注意:php72 是您的 php 版本。 -d register_argc_argv=1 防止重叠。 /home/schedule.log 是可选的。 2>&1 & 是时间戳。
Laravel/storage/logs/laravel.log
[2020-04-08 10:41:01] staging.ERROR: Invalid argument supplied for foreach() {"exception":"[object] (ErrorException(code: 0): Invalid argument supplied for foreach() at /home/u8614269/laravel/fti-presensi/vendor/symfony/console/Input/ArgvInput.php:246)
[stacktrace]
#0 /home/u8614269/laravel/fti-presensi/vendor/symfony/console/Input/ArgvInput.php(246): Illuminate\Foundation\Bootstrap\HandleExceptions->handleError(2, 'Invalid argumen...', '/home/u8614269/...', 246, Array)
#1 /home/u8614269/laravel/fti-presensi/vendor/symfony/console/Application.php(1060): Symfony\Component\Console\Input\ArgvInput->getFirstArgument()
#2 /home/u8614269/laravel/fti-presensi/vendor/laravel/framework/src/Illuminate/Console/Application.php(84): Symfony\Component\Console\Application->getCommandName(Object(Symfony\Component\Console\Input\ArgvInput))
#3 /home/u8614269/laravel/fti-presensi/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(131): Illuminate\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#4 /home/u8614269/laravel/fti-presensi/artisan(36): Illuminate\Foundation\Console\Kernel->handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#5 {main}
如果输出是这样的:
Running scheduled command: '/opt/alt/php72/usr/bin/php-cgi' 'artisan' command:your-command > '/dev/null' 2>&1
X-Powered-By: PHP/7.2.26
Content-type: text/html; charset=UTF-8
也许问题是/opt/alt/php72/usr/bin/php-cgi
如果您使用使用 PHP 选择器的共享主机,这个 cron 脚本适合我...
* * * * * /opt/alt/php72/usr/bin/php -q -d register_argc_argv=1 /laravel_app_path/artisan schedule:run >> /home/schedule.log 2>&1 &
注意:php72 是您的 php 版本。 -d register_argc_argv=1 防止重叠。 /home/schedule.log 是可选的。 2>&1 & 是时间戳。