简体   繁体   English

如何降级 PHP 版本(您的 PHP 版本不满足该要求)?

[英]How to downgrade PHP version (Your PHP version does not satisfy that requirement)?

After running sudo apt-get update && sudo apt-get dist-upgrade on my Laravel app, I'm getting this error on the next deployment:在我的 Laravel 应用程序上运行sudo apt-get update && sudo apt-get dist-upgrade后,我在下一次部署时收到此错误:

- This package requires php ^7.1.3 but your PHP version (8.1.6) does not satisfy that requirement.

In my composer.json, ^7.1.3 is the specified version.在我的 composer.json 中,^7.1.3 是指定的版本。 This is my first time running the apt-get update and I don't know why the php version got updated as well.这是我第一次运行 apt-get 更新,我不知道为什么 php 版本也会更新。

On each deployment I run在我运行的每个部署中

composer install --no-interaction --prefer-dist --optimize-autoloader

How can I downgrade the version to 7.1.3 ?如何将版本降级到7.1.3 This happens on an existing app in production and I have to be very careful about it.这发生在生产中的现有应用程序上,我必须非常小心。

The php version installed on your environment should be compatible with your project.您的环境中安装的 php 版本应该与您的项目兼容。

If your project is based on composer package manager (as I see), it can help you to control which php version you need on the server.如果您的项目基于 composer package 管理器(如我所见),它可以帮助您控制服务器上需要哪个 php 版本。

In your case I would recommend to restore from the snapshot or just install php 7.1.3 version back.在您的情况下,我建议从快照中恢复或只安装 php 7.1.3 版本。

If you want to use php 7.4/8/8.1 in your project, before you should upgrade your code and project dependencies and ensure, that everything working fine with the desired version of php.如果您想在您的项目中使用 php 7.4/8/8.1,在升级您的代码和项目依赖项之前,请确保一切都与所需版本的 php 一起正常工作。

Old topic, but for things like this, I recommend adding the flag to ignore requirements like this.老话题,但是对于这样的事情,我建议添加标志来忽略这样的要求。 So try:所以试试:

composer install --no-interaction --prefer-dist --optimize-autoloader --ignore-platform-reqs

There may be incompatibilities with your project using 8.1 instead of 7.1.3, but I doubt it.使用 8.1 而不是 7.1.3 可能与您的项目不兼容,但我对此表示怀疑。 But still, only do this if you feel confident the PHP version won't be an issue.但是,只有当您确信 PHP 版本不会成为问题时,才这样做。 It's usually better than downgrading, however.但是,这通常比降级要好。

暂无
暂无

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

相关问题 照明/配置 v5.8.4 需要 php ^7.1.3 -> 您的 PHP 版本 (5.6.40) 不满足该要求 - illuminate/config v5.8.4 requires php ^7.1.3 -> your PHP version (5.6.40) does not satisfy that requirement Symfony2, composer, 你的 PHP 版本 (5.6.18) 被 "config.platform.php" 版本 (5.3.9) 覆盖不满足要求 - Symfony2, composer, your PHP version (5.6.18) overriden by "config.platform.php" version (5.3.9) does not satisfy requirement laravel/lumen-framework 5.8.x-dev 需要 php ^7.1.3 -> 您的 PHP 版本(8.0.2)不满足该要求 - laravel/lumen-framework 5.8.x-dev requires php ^7.1.3 -> your PHP version (8.0.2) does not satisfy that requirement doctrine / inflector v1.3.0需要php ^ 7.1->您的PHP版本(7.0.0)不满足该要求。`,我无法更新php版本。 - doctrine/inflector v1.3.0 requires php ^7.1 -> your PHP version (7.0.0) does not satisfy that requirement.` and i can't update php version 如何在Heroku上降级PHP版本 - How to downgrade PHP version on Heroku Heroku降级PHP版本 - Heroku Downgrade PHP Version 参考 - 升级 PHP 后 Composer 错误“您的 PHP 版本不满足要求” - Reference - Composer error "Your PHP version does not satisfy requirements" after upgrading PHP 降级 PHP 版本 Laravel 5.8 - Downgrade PHP version Laravel 5.8 是否可以在 laravel 8 中降级 php 版本 - Is it possible to downgrade php version in laravel 8 版本中的 laravel/ui 包的 PHP 要求与您的 PHP 版本 (5.6.40) 不兼容 - Package laravel/ui at version has a PHP requirement incompatible with your PHP version (5.6.40)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM