在 ubuntu 服务器 22.10 上安装 PHP

问题描述 投票:0回答:1

我正在尝试在 Ubuntu 22.10 上安装 php,我曾经能够执行“

apt install php
”并完成它,但现在由于某种原因我不能?

当我运行 install php 时,我得到的是:

root@backups:/# apt install php
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 php8.2 : Depends: libapache2-mod-php8.2 but it is not installable or
                   php8.2-fpm but it is not installable or
                   php8.2-cgi but it is not installable
          Depends: php8.2-common but it is not installable
E: Unable to correct problems, you have held broken packages.

我真的不在乎我能得到哪个版本的 php,只要它是 7 或 8,我试过很多指南,他们都告诉你要么添加这个(http://ppa.launchpad.net/ondrej /php/ubuntu/pool/main/p/php8.1/) repository (这不起作用)或者只是运行 apt install,这也不起作用。或者它的一些变体。

我可以安装任何程序,除了 PHO 或 PHP 相关的依赖项或包。

安装依赖时我得到:

root@backups:/# sudo apt install php8.1-fpm
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 php8.1-fpm : Depends: php8.1-common (= 8.1.18-1+ubuntu20.04.1+deb.sury.org+1) but 8.1.7-1ubuntu3.3 is to be installed
E: Unable to correct problems, you have held broken packages.

添加 ppa:ondrej/php 存储库导致:

root@backups:/var/www/snipeit# sudo add-apt-repository ppa:ondrej/nginx-mainline
PPA publishes dbgsym, you may need to include 'main/debug' component
Repository: 'deb https://ppa.launchpadcontent.net/ondrej/nginx-mainline/ubuntu/ kinetic main'
Description:
This branch follows latest NGINX Mainline packages compiled against latest OpenSSL for HTTP/2 and TLS 1.3 support.

BUGS&FEATURES: This PPA now has a issue tracker: https://deb.sury.org/#bug-reporting

PLEASE READ: If you like my work and want to give me a little motivation, please consider donating: https://donate.sury.org
More info: https://launchpad.net/~ondrej/+archive/ubuntu/nginx-mainline
Adding repository.
Press [ENTER] to continue or Ctrl-c to cancel.

继续只是在更新时抛出一个错误

E: The repository 'https://ppa.launchpadcontent.net/ondrej/nginx-mainline/ubuntu kinetic Release' does not have a Release file.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.

我猜这个问题是由于 22.10 相当新,但我一直安装最新版本的 Ubuntu 并且安装程序从来没有问题,我认为这就是 Linux 的全部意义,稳定可靠。

我可以重新安装旧版本,但我想尽可能避免这种情况,因为我在那台机器上运行了更多服务。

php ubuntu-server fpm php-8.1
1个回答
-1
投票

我真的推荐通过 Ondřej Surý 的 PPA 安装 PHP

sudo add-apt-repository ppa:ondrej/php
sudo apt update
sudo apt search php

您不仅可以安装 PHP,还可以安装其大部分流行的 PECL 包。

© www.soinside.com 2019 - 2024. All rights reserved.