1、更新依赖
composer.json修改为
App\Exceptions\Handler修改为
增加use Throwable;
其余两句修改
config\session.php修改如下
'secure' => env('SESSION_SECURE_COOKIE', null),
'same_site' => 'lax',
2、执行升级
composer update
执行后报错如下:
PHP Deprecated: Directive 'track_errors' is deprecated in Unknown on line 0
Deprecated: Directive 'track_errors' is deprecated in Unknown on line 0
PHP Deprecated: Directive 'track_errors' is deprecated in Unknown on line 0
Deprecated: Directive 'track_errors' is deprecated in Unknown on line 0
Loading composer repositories with package information
Updating dependencies
Your requirements could not be resolved to an installable set of packages.
Problem 1
- Root composer.json requires fideloper/proxy ^4.0, found fideloper/proxy[4.4.1] in the lock file but not in remote repositories, make sure you avoid updating this package to keep the one from the lock file.
Problem 2
- Root composer.json requires gregwar/captcha ^1.1, found gregwar/captcha[v1.1.9] in the lock file but not in remote repositories, make sure you avoid updating this package to keep the one from the lock file.
Problem 3
- Root composer.json requires guzzlehttp/guzzle ^7.4, found guzzlehttp/guzzle[7.4.2] in the lock file but not in remote repositories, make sure you avoid updating this package to keep the one from the lock file.
Problem 4
……
解决方案一:
更改composer镜像
查看镜像地址并更换(composer国内可能较慢切换国内镜像)
查看镜像: composer config -g -l
更换阿里云镜像
composer config -g repo.packagist composer https://mirrors.aliyun.com/composer/
再执行 composer update
解决方案二:
composer update --ignore-platform-regs
使用强制安装更新
注意:composer.json文件中 "require": { "php": "^7.3",} 须为laravel框架以上版本
laravel7升级laravel8中
composer update 后有时候回报很多错误 ,错误如下:
Problem 1
- Root composer.json requires barryvdh/laravel-ide-helper ^2.8, found barryvdh/laravel-ide-helper[v2.8.0] in the lock file but not in remote repositories, make sure you avoid updating this package to keep the one from the lock file.
Problem 2
- Root composer.json requires fideloper/proxy ^4.0, found fideloper/proxy[4.4.2] in the lock file but not in remote repositories, make sure you avoid updating this package to keep the one from the lock file.
........
解决办法:
更换阿里云镜像
composer config -g repo.packagist composer https://mirrors.aliyun.com/composer/
再执行 composer update 升级laravel8