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);
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:
The null coalescing operator (??) has been added as syntactic sugar for the common case of needing to use a ternary in conjunction with isset(). It returns its first operand if it exists and is not NULL; otherwise it returns its second operand.
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:
PHP >= 7.1.3 OpenSSL PHP Extension PDO PHP Extension Mbstring PHP Extension Tokenizer PHP Extension XML PHP Extension Ctype PHP Extension JSON PHP Extension
Hope this helps!