问题
I am trying to back up my database in Laravel using Spatie package. Every thing worked fine till 31 Decemeber 2020 and in New Year my cron job stoped working. I don't know what happened, but on my cPanel mail I am receiving this email:
/usr/local/cpanel/bin/jailshell: -c: line 0: syntax error near unexpected token `newline'
/usr/local/cpanel/bin/jailshell: -c: line 0: `/usr/local/bin/php /home2/scoopscr/public_html/artisan backup:run 1>> '
and this is the cron job I am applying:
/usr/local/bin/php /home2/scoopscr/public_html/artisan backup:run 1>> /dev/null 2>&1
回答1:
possible solutions
- check your php version and php multimanager in cpanel both match or not
- go to storage/log/laravel log read cron error
- in any controller use
use Illuminate\Support\Facades\Artisan; Artisan::call('backup:run'); dd(Artisan::output());
now you can check your command working or not and able to find errors
来源:https://stackoverflow.com/questions/65872966/syntax-error-near-unexpected-token-newline-in-cpanel