1、升级前先备份好代码(打个压缩包),或者SVN,GIT提交好代码,因为要准备还原。
2、仔细阅读了升级相关注意事项:
https://laravel-china.org/docs/laravel/5.5/upgrade/1280
然后 composer update
升级成功了。
运行 php artisan
报错了,查看日志:
dev.ERROR: Parse error: syntax error, unexpected '?', expecting variable (T_VARIABLE) {"exception":"[object] (Symfony\\Component\\Debug\\Exception\\FatalThrowableError(code: 0): Parse error: syntax error, unexpected '?', expecting variable (T_VARIABLE) at /home/www/dev/shihui91/vendor/symfony/translation/Translator.php:79)
懵逼了,吐槽下 Laravel 报错信息,也不知道具体哪里有问题。
找资料才发现是 PHP版本不足导致的,需要PHP版本 >=7.1.3 。
原文:
https://stackoverflow.com/questions/48787078/laravel-5-parse-error-syntax-error-unexpected-expecting-variable-t-var
You need to install PHP version 7.1 because nullable types were introduced in 7.1: ?string $value And from the Laravel docs: You will need to make sure your server meets the following requirements: PHP >= 7.1.3
laravel 5.4 可以同时在 php7 和 php5.6 上运行,升级PHP版本暂时不可行,还是还原代码吧!!!