skip to Main Content

I got this error in error_log after create cron job on cpanel.

PHP Parse error: syntax error, unexpected T_CLASS, expecting T_STRING
or T_VARIABLE or ‘$’ in /home/kardenoc/Smartflyer/artisan on line 33

this is the line mentioned:

$kernel = $app->make(IlluminateContractsConsoleKernel::class);

I’m using php 7.2(choose php 7.2 on cpanel) and laravel 6.
whole process is working expect this cron job.

2

Answers


  1. Your Cpanel version could be different from laravel version please check composer.json for this line

    "require": {
            "php": ">=5.5.9"
    
    Login or Signup to reply.
  2. I think the php command in the cPanel is using an older version.

    The quick solution for you is to use the php7.2 command. E.g. put this in the cron job:

    php7.2 artisan schedule:run >> /dev/null 2>&1
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search