Ich habe eine in Laravel9 geschriebene Dummy-Website auf einem Ubuntu 18.04-Server, sie erfordert PHP-Version 8.0.2 oder h?her. Der Fehler sieht im Browser so aus:
Composer hat ein Problem auf Ihrer Plattform erkannt: Ihre Composer-Abh?ngigkeit erfordert die PHP-Version ?>= 8.0.2“.
Im System habe ich PHP 7.4.29 (cli), kann es aber nicht ?ndern, da andere virtuelle Websites 7.4 erfordern.
Wie bekomme ich PHP 8.1 auf die Laravel9-Site, damit es funktioniert?
如果使用 Debian/Ubuntu:
apt -y install software-properties-common add-apt-repository ppa:ondrej/php apt -y install php8.1
CentOS:
dnf install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm dnf install dnf-utils http://rpms.remirepo.net/enterprise/remi-release-8.rpm dnf remove php* -y dnf module list reset php -y dnf module enable php:remi-8.1 dnf install php
好吧,發(fā)現(xiàn)需要的是一個(gè)composer命令:
composer install --ignore-platform-reqs
所以現(xiàn)在不再有錯(cuò)誤了。現(xiàn)在我還有其他事情要擔(dān)心,但那是 Laravel 的事情。
盡管現(xiàn)在是 php 8.1,我的其他網(wǎng)站仍然可以正常工作。
感謝您的幫助。