简体   繁体   中英

Getting HTTP ERROR 500 after deploying my laravel app on shared hosting

After I deployed my laravel app on shared hosting, I am getting a HTTP ERROR 500.. I checked my error log file and saw this:

PHP Parse error:  syntax error, unexpected '?' in 
/home/shelterm/public_html/vendor/laravel/framework/src/Illuminate/Foundation/helpers.php on line 500
if (isset($arguments[1]) && is_string($arguments[1])) {
      return $factory->of($arguments[0], $arguments[1])->times($arguments[2] ?? null); 
} elseif (isset($arguments[1])) {
      return $factory->of($arguments[0])->times($arguments[1]);
}

The same laravel app works perfectly on my localhost(XAMPP)

PHP Version 7.3.1

According to the Laravel manual, Laravel 5.8 needs the following requirements:

  1. PHP >= 7.1.3
  2. BCMath PHP Extension
  3. Ctype PHP Extension
  4. JSON PHP Extension
  5. Mbstring PHP Extension
  6. OpenSSL PHP Extension
  7. PDO PHP Extension
  8. Tokenizer PHP Extension
  9. XML PHP Extension

So, your problem is the php version you use on shared host.

On Your Server Panel Home, Look for Software Tab and Select MultiPHP Manager

Go to MultiPHP Manager Select the domain, Locate PHP version, Change the php version to Latest version and apply..

You should see the available Php versions on your shared hosting server, select the Latest and apply

Done

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM