Search code examples
laravelcronscheduled-taskslaravel-7cron-task

Laravel Cronjob :: Status: 404 Not Found X-Powered-By: PHP/7.3.20 Content-type: text/html; charset=UTF-8 No input file specified


i dont understand with this error message from cronjob log

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

No input file specified.

this is my command in cronjob

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

this is my schedule in 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();
    }

Please help me


Solution

  • try

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

    To change ini config you need the option d

    -d foo[=bar] Define INI entry foo with value 'bar'

    it was trying to find the file register_argc_argv=1 and got 404