Tuesday 26 December 2017

How to solve a PHP error in Laravel without changing the version?

I have run into a problem when trying to upload my Laravel
project to my live web server. Everything works perfectly on local server. But, my local
server is running PHP 7.2.6, and my host server only supports 7.1 at this time. So, when
I try to set up cron jobs for my server to run my Laravel scheduled tasks, I get this
error:



Parse
error: syntax error, unexpected 'class' (T_CLASS), expecting identifier (T_STRING) or
variable (T_VARIABLE) or '{' or '$' in /home/me/project/artisan on line
31



This line
contains:


$kernel =
$app->make(Illuminate\Contracts\Console\Kernel::class);

And
I know the issue has to do with calling Kernel::class, but I am
unable to change the PHP version to 7.2 to solve this. So, is there another workaround?
My only worry is that even if I took care of this error, that there would be
more.

No comments:

Post a Comment

php - file_get_contents shows unexpected output while reading a file

I want to output an inline jpg image as a base64 encoded string, however when I do this : $contents = file_get_contents($filename); print &q...