I have a dummy website written in Laravel9 on an ubuntu 18.04 server, it requires php version 8.0.2 or higher. The error looks like this in the browser:
Composer has detected a problem on your platform: Your Composer dependency requires PHP version '>= 8.0.2'.
In the system I have PHP 7.4.29 (cli) but can't change it since other virtual sites require 7.4.
How to get php 8.1 to Laravel9 site to make it work?
P粉0378809052024-03-27 09:46:35
If using 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
P粉7935324692024-03-27 09:30:42
Okay, I found that what is needed is a composer command:
composer install --ignore-platform-reqs
So now there are no more errors. Now I have other things to worry about, but that's Laravel's thing.
My other sites still work fine despite now being on php 8.1.
thanks for your help.