简体   繁体   English

PHP 版本 Laravel

[英]PHP Version of Laravel

Does a Laravel project require 2 versions of PHP? Laravel 项目是否需要 2 个版本的 PHP?

I am working on a Laravel project.我正在研究 Laravel 项目。 I have 2 versions of PHP in my computer.我的电脑中有 2 个版本的 PHP。 If I set PHP version 8.1 and run composer update I am getting below error.如果我设置 PHP 版本 8.1 并运行 composer update 我得到以下错误。

在此处输入图像描述

If I set PHP version 7.4 and run composer update I am getting below error.如果我设置 PHP 版本 7.4 并运行 composer update 我得到以下错误。

在此处输入图像描述

What will be the solution?解决方案是什么?

On Linux I use update-alternatives .在 Linux 我使用update-alternatives You can do sudo update-alternatives --config php , and after that you can check your default version by PHP -v If it does not work please run these commands:您可以执行sudo update-alternatives --config php ,然后您可以通过PHP -v检查您的默认版本,如果它不起作用,请运行以下命令:

composer clear-cache
composer self-update
composer update --ignore-platform-reqs

I hope it helps you.我希望它对你有帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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