Laravel Cronjob ::状态:404未找到X-Powered-By:PHP / 7.3.20内容类型:text / html; charset = UTF-8未指定输入文件

问题描述

我不理解cronjob日志中的此错误消息

Status: 404 Not Found
X-Powered-By: PHP/7.3.20
Content-type: text/html; charset=UTF-8

No input file specified.

这是我在cronjob中的命令

cd /home/host/public_html && PHP register_argc_argv=1 artisan schedule:run >> /home/host/public_html/backup.log 2>&1

这是我在kernel.PHP中的时间表

protected function schedule(Schedule $schedule)
    {
        $schedule->call(function () {
            $filename1 = base_path("/CSV/data.csv");
            $filesize1 = filesize($filename1);
            if($filesize1 > 0)
            {
                $file1 = fopen(base_path("/CSV/data.csv"),"r");
                  while (($getData1 = fgetcsv($file1,10000,";")) !== FALSE)
                  {
                    DB::table('tbdata')->insert([
                        'ID' => $getData1[0],'Date_' => $getData1[1],'Date' => $getData1[2],'Status' => $getData1[3],'Remark' => $getData1[4],'SMS' => $getData1[5]
                    ]);
                  }       
                  fclose($file1);   
              unlink(base_path("/CSV/data.csv"));
            }
        })->daily();
    }

请帮助我

解决方法

尝试

cd /home/host/public_html && php -d register_argc_argv=1 artisan schedule:run >> /home/host/public_html/backup.log 2>&1

要更改ini配置,您需要选项d

-d foo [= bar]用值'bar'定义INI条目foo

它试图查找文件register_argc_argv=1并得到404