如何在平台中求解作曲家检测到的问题:您的作曲家依赖性需要PHP版本“ = 8.0.2”。

发布于 2025-02-04 11:31:18 字数 606 浏览 2 评论 0原文

上传我的Laravel版本8.5文件后。我不断获得此显示,而不是着陆页:

作曲家在您的平台中检测到的问题:您的作曲家依赖性需要PHP版本“> = 8.0.2”。

我运行以下命令:

a2dismod php7.4
a2enmod php8.1
service apache2 restart
update-alternatives --set php /usr/bin/php8.1
update-alternatives --set phar /usr/bin/phar8.1
update-alternatives --set phar.phar /usr/bin/phar.phar8.1

我还使用:/ etc/init.d/apache2重新启动

但是即使清除了浏览器缓存,我也会继续进行相同的显示。

我敢肯定,Apache仍在根据以下情况下引用以前的PHP版本:phpinfo()

完整披露: 我不熟悉Linux。我的操作系统是Ubuntu 20.04,而我的旧php版本为7.4.29,新的PHP版本为8.1

After uploading my Laravel version 8.5 files. I keep getting this display instead of the landing page:

Composer detected issues in your platform: Your Composer dependencies require a PHP version ">= 8.0.2".

I've run the following commands:

a2dismod php7.4
a2enmod php8.1
service apache2 restart
update-alternatives --set php /usr/bin/php8.1
update-alternatives --set phar /usr/bin/phar8.1
update-alternatives --set phar.phar /usr/bin/phar.phar8.1

I've also restarted Apache with: /etc/init.d/apache2 restart

But I keep getting the same display, even after clearing my browser cache.

I'm sure Apache is still referencing the former PHP version according to: phpinfo()

Full Disclosure:
I'm not proficient with Linux. My OS is Ubuntu 20.04, while my old PHP version is 7.4.29 and new PHP version is 8.1

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

多彩岁月 2025-02-11 11:31:18

也有同样的问题。发现安装了多种版本的PHP,Apache引用了以前的PHP版本之一。使用A2Dismod禁用每个以前的版本,直到引用正确的版本为止。希望这会有所帮助。

Had the same issue. Found that there were multiple versions of php installed and Apache was referencing one of the former PHP versions. Disabled each former version using a2dismod until the right version was being referenced. Hope this helps.

攒一口袋星星 2025-02-11 11:31:18

您可以在Composer.json文件中指定以下依赖项:
降级: -

{
    "require": {
        "php": "^7.4.8",
        "laravel/framework": "^8.0",
        "laravel/tinker": "^2.0"
    }
}

升级: -

{
    "require": {
        "php": "^8.0.2",
        "laravel/framework": "^8.0", //insert your current laravel version here
        "laravel/tinker": "^2.0"
    }
}

然后运行Composer Install,Composer Update更新/更新依赖关系。

我遇到了同样的问题并通过此解决方案解决了它,之后,即使是PHP版本检查器也开始检查7.4.8而不是8.0.2

You can specify the following dependencies in your composer.json file:
To Downgrade :-

{
    "require": {
        "php": "^7.4.8",
        "laravel/framework": "^8.0",
        "laravel/tinker": "^2.0"
    }
}

To Upgrade:-

{
    "require": {
        "php": "^8.0.2",
        "laravel/framework": "^8.0", //insert your current laravel version here
        "laravel/tinker": "^2.0"
    }
}

Then run composer install, composer update to install/update the dependencies.

I had the same issue and solved it by this solution and after that even the php version checker began to check for 7.4.8 instead of the 8.0.2

煮酒 2025-02-11 11:31:18

我不认为这是您的PHP。我认为这是您的作曲家配置。作曲家是您的PHP和应用程序之间的链接。参见 php版本“> = 8.0.2”

I don't think it's your PHP that's the problem. I think it is your Composer configuration. Composer is the link between your PHP and your apps. See How to solve Composer detected issues in your platform: Your Composer dependencies require a PHP version ">= 8.0.2"

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文