I am trying to deploy a Laravel application on a shared hosting but I am getting HTTP ERROR 500 when I try to access the web in the browser.
I have configured my index.php file, and my php version is 5.6.
Does anyone know how I can fix this?
Here is my error log:
PHP Parse error: syntax error, unexpected '?' in /home/umugeoyw/umugabo/vendor/laravel/framework/src/Illuminate/Foundation/helpers.php on line 500
and on line 500 in helpers.php I have this:
return $factory->of($arguments[0], $arguments[1])->times($arguments[2] ?? null);
2
Answers
Your problem is the PHP Version. Laravel is using a Null coalescing operator here (??). Since this feature is only available on PHP 7.0 and later, your server will squark.
In your DevEnv you probably do have PHP 7.0 +.
You can checkout the docs here. From the docs:
PHP 5.6 is outdated anyways, so you really should consider updating! Btw.: Laravel requires PHP 7.1.3, which is clearly stated in their docs:
Hope this helps!
As errorinpersona described, you should change php version of your server from cpanel settings and match it with the version on your local server, and you should be good.