无法在 ubuntu 上安装 php 8.0,E:存储库“https://ppa.launchpadcontent.net/ondrej/php/ubuntu jammy Release”没有发布文件

Gun*_*tar 5 php ubuntu nginx php-8 ubuntu-20.04

我正在尝试在 vultr 的 Ubuntu 22.04 服务器上安装 LEMP。\n我可以安装 Nginx sudo apt install -y nginx- 没问题。

\n

但是当我尝试通过运行这些命令安装 php8.0 时

\n
sudo apt install software-properties-common\nsudo add-apt-repository ppa:ondrej/php\nsudo apt-get update\n
Run Code Online (Sandbox Code Playgroud)\n

我不断收到错误The repository 'https://ppa.launchpadcontent.net/ondrej/php/ubuntu jammy Release' does not have a Release file.

\n

sudo add-apt-repository ppa:ondrej/php这是运行命令后得到的结果

\n
root@ubuntu:~# sudo add-apt-repository ppa:ondrej/php\nPPA publishes dbgsym, you may need to include 'main/debug' component\nRepository: 'deb https://ppa.launchpadcontent.net/ondrej/php/ubuntu/ jammy main'\nDescription:\nCo-installable PHP versions: PHP 5.6, PHP 7.x and most requested extensions are included. Only Supported Versions of PHP (http://php.net/supported-versions.php) for Supported Ubuntu Releases (https://wiki.ubuntu.com/Releases) are provided. Don't ask for end-of-life PHP versions or Ubuntu release, they won't be provided.\n\nDebian oldstable and stable packages are provided as well: https://deb.sury.org/#debian-dpa\n\nYou can get more information about the packages at https://deb.sury.org\n\nIMPORTANT: The <foo>-backports is now required on older Ubuntu releases.\n\nBUGS&FEATURES: This PPA now has a issue tracker:\nhttps://deb.sury.org/#bug-reporting\n\nCAVEATS:\n1. If you are using php-gearman, you need to add ppa:ondrej/pkg-gearman\n2. If you are using apache2, you are advised to add ppa:ondrej/apache2\n3. If you are using nginx, you are advised to add ppa:ondrej/nginx-mainline\n\xc2\xa0\xc2\xa0\xc2\xa0or ppa:ondrej/nginx\n\nPLEASE READ: If you like my work and want to give me a little motivation, please consider donating regularly: https://donate.sury.org/\n\nWARNING: add-apt-repository is broken with non-UTF-8 locales, see\nhttps://github.com/oerdnj/deb.sury.org/issues/56 for workaround:\n\n# LC_ALL=C.UTF-8 add-apt-repository ppa:ondrej/php\nMore info: https://launchpad.net/~ondrej/+archive/ubuntu/php\nAdding repository.\nPress [ENTER] to continue or Ctrl-c to cancel.\nFound existing deb entry in /etc/apt/sources.list.d/ondrej-ubuntu-php-jammy.list\nAdding deb entry to /etc/apt/sources.list.d/ondrej-ubuntu-php-jammy.list\nFound existing deb-src entry in /etc/apt/sources.list.d/ondrej-ubuntu-php-jammy.list\nAdding disabled deb-src entry to /etc/apt/sources.list.d/ondrej-ubuntu-php-jammy.list\nAdding key to /etc/apt/trusted.gpg.d/ondrej-ubuntu-php.gpg with fingerprint 14AA40EC0831756756D7F66C4F4EA0AAE5267A6C\nGet:1 http://us.clouds.archive.ubuntu.com/ubuntu jammy InRelease [270 kB]\nHit:2 http://security.ubuntu.com/ubuntu jammy-security InRelease\nHit:3 https://ppa.launchpadcontent.net/canonical-kernel-team/unstable/ubuntu jammy InRelease\nHit:4 http://us.clouds.archive.ubuntu.com/ubuntu jammy-updates InRelease\nHit:5 http://us.clouds.archive.ubuntu.com/ubuntu jammy-backports InRelease\nGet:6 http://us.clouds.archive.ubuntu.com/ubuntu jammy/main amd64 Packages [1,408 kB]\nIgn:7 https://ppa.launchpadcontent.net/ondrej/php/ubuntu jammy InRelease\nGet:8 http://us.clouds.archive.ubuntu.com/ubuntu jammy/universe amd64 Packages [14.1 MB]\nErr:9 https://ppa.launchpadcontent.net/ondrej/php/ubuntu jammy Release\n  404  Not Found [IP: 91.189.95.85 443]\nGet:10 http://us.clouds.archive.ubuntu.com/ubuntu jammy/universe Translation-en [5,645 kB]\nGet:11 http://us.clouds.archive.ubuntu.com/ubuntu jammy/universe amd64 c-n-f Metadata [286 kB]\nReading package lists... Done\nE: The repository 'https://ppa.launchpadcontent.net/ondrej/php/ubuntu jammy Release' does not have a Release file.\nN: Updating from such a repository can't be done securely, and is therefore disabled by default.\nN: See apt-secure(8) manpage for repository creation and user configuration details.\n
Run Code Online (Sandbox Code Playgroud)\n

有什么想法/建议为什么会发生这种情况以及我应该采取什么不同的做法吗?

\n

Chi*_*wan 8

这是22.10的结果尚未发布的问题 ppa:ondrej/php 存储库。它将通过 ppa:ondrej/php 修复它,但我已经找到了解决方案,我不认为这是最好的解决方案,

nano /etc/apt/sources.list.d/ondrej-ubuntu-php-kinetic.list
Run Code Online (Sandbox Code Playgroud)

然后添加这一行并保存

deb https://ppa.launchpadcontent.net/ondrej/php/ubuntu/ jammy main
#deb-src https://ppa.launchpadcontent.net/ondrej/php/ubuntu/kinetic main
Run Code Online (Sandbox Code Playgroud)

然后尝试再次安装

PHP 7.2

sudo apt-get install php7.2 php7.2-fpm
sudo apt-get install php7.2-mysql php7.2-mbstring php7.2-xml php7.2-gd php7.2-curl
Run Code Online (Sandbox Code Playgroud)

PHP 8.0

sudo apt-get install php8.0 php8.0-fpm
sudo apt-get install php8.0-mysql php8.0-mbstring php8.0-xml php8.0-gd php8.0-curl
Run Code Online (Sandbox Code Playgroud)

对于这个答案,我已经帮助了这些link_01 link_02

现在已经成功安装了PHP,因此您可以轻松切换PHP版本,

 sudo update-alternatives --config php
Run Code Online (Sandbox Code Playgroud)

选择版本输入数字,现在检查PHP版本

php -v
Run Code Online (Sandbox Code Playgroud)