解決 Ubuntu 22.04 不支援 php7.4 問題

問題

安裝Linux php7.4時,發現Ubuntu 22.04不支援php7.4

1
$ apt-get install php7.4-fpm -y

Reading package lists… Done
Building dependency tree… Done
Reading state information… Done
Package php7.4 is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
E: Package ‘php7.4’ has no installation candidate

解決方法

安裝舊版的套件包

1
2
$ add-apt-repository ppa:ondrej/php && apt update -y
$ update-alternatives --config php

參考網站: