微盟属于营销型手机网站,保险咨询免费24小时在线,企业邮箱号码,ssh网站怎么做问题
正在使用Ubuntu 22.04设置服务器#xff0c;并使用WHM/cPanel管理多个帐户和配置。我的目标是在服务器上安装 PHP 7.4#xff08;或更早的版本#xff0c;如 PHP 7.3#xff09;#xff0c;因为我的一些应用程序与 PHP 8.x 不兼容。问题是#xff0c;每当我尝试安装…问题
正在使用Ubuntu 22.04设置服务器并使用WHM/cPanel管理多个帐户和配置。我的目标是在服务器上安装 PHP 7.4或更早的版本如 PHP 7.3因为我的一些应用程序与 PHP 8.x 不兼容。问题是每当我尝试安装 PHP 7.x 时我都会遇到错误指出软件包缺失、过时或不可用。
服务器配置 操作系统 Ubuntu Server 22.04 LTS 管理软件: WHM/cPanel PHP 要求 PHP 7.4、PHP 7.3
问题详细信息 当我尝试为我的一个帐户配置 PHP 7.x 时我第一次通过 WHM 注意到了这个问题。我意识到 PHP 7.x 软件包默认情况下不可供安装。然后我尝试了多种解决方案来手动安装 PHP 7.x但都失败了。
到目前为止我尝试过的方法 添加了 SURY PPA 存储库 我添加了ppa:ondrej/php存储库据说其中包含较旧的 PHP 版本包括 7.4 和 7.3。使用的命令
sudo apt update
sudo add-apt-repository ppa:ondrej/php
sudo apt update
sudo apt install -y php7.4 php7.4-cli php7.4-fpm php7.4-mysql结果安装失败出现错误例如“包 php7.4-common 不可用但被另一个包引用。”
尝试直接下载.deb软件包 我.deb手动下载了单个 PHP 7.4 软件包及其依赖项并尝试使用 进行安装dpkg。手动安装所需的依赖项后我仍然遇到软件包兼容性问题。
尝试通过 Docker 安装 PHP 7.x但这并不理想 我能够在 Docker 容器中运行 PHP 7.4但理想情况下我想避免使用 Docker 并将 PHP 7.4 直接安装在服务器上以便于使用 WHM 进行管理。
检查并重新添加依赖项 在遇到缺少诸如此类的包的依赖项后libicu70我尝试手动安装依赖项但仍然不允许安装 PHP 7.x。
错误消息 在尝试安装php7.x的过程中反复出现的错误是 rootsrv:/# sudo apt install -y php7.3 php7.3-cli php7.3-fpm php7.3-common php7.3-mysql php7.3-zip php7.3-gd php7.3-mbstring php7.3-curl php7.3-xml php7.3-bcmath
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Package php7.3-common 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 sourcePackage php7.3-cli 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 sourcePackage php7.3-mbstring 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 sourcePackage php7.3-xml 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 sourcePackage php7.3 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 sourcePackage php7.3-fpm 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 sourcePackage php7.3-bcmath 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 sourcePackage php7.3-curl 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 sourcePackage php7.3-gd 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 sourcePackage php7.3-mysql 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 sourcePackage php7.3-zip 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 sourceE: Package php7.3 has no installation candidate
E: Package php7.3-cli has no installation candidate
E: Package php7.3-fpm has no installation candidate
E: Package php7.3-common has no installation candidate
E: Package php7.3-mysql has no installation candidate
E: Package php7.3-zip has no installation candidate
E: Package php7.3-gd has no installation candidate
E: Package php7.3-mbstring has no installation candidate
E: Package php7.3-curl has no installation candidate
E: Package php7.3-xml has no installation candidate
E: Package php7.3-bcmath has no installation candidate
rootsrv:/#有没有办法强制 Ubuntu 22.04 安装 PHP 7.x我是否错过了在此版本的 Ubuntu 上直接安装 PHP 7.3 或 7.4 的任何步骤或替代方法或者有没有办法设置 WHM 以使用来自自定义源的 PHP 7.x
PS我首先尝试安装php7.4当完全无法安装时我尝试了php7.3但结果是一样的并且本问题中显示的结果来自php7.3的安装
附言从技术上讲我可以通过使用较旧的 Ubuntu 版本创建新磁盘来解决这个问题但这需要我重新配置整个服务器包括所有客户端的 WHM 和 cPanel这非常耗时。老实说我觉得这不应该是个问题我不想简单地接受它无法解决。
附言我对服务器配置还很陌生因此我在这方面的知识有限。我已尝试严格按照描述遵循每个建议但可能我遗漏或误解了某些内容。任何指导都将不胜感激
解决方案
最好升级您的系统以便获得全面支持。
但是如果由于特殊原因您必须坚持在 Ubuntu 22.04 上使用 PHP7.x在 Ubuntu 22.04 上安装 php7.4 / php7.3那么您需要执行以下步骤
sudo apt update
sudo apt upgradesudo apt install software-properties-common curl gnupg2 wget -y之后添加存储库
sudo add-apt-repository ppa:ondrej/php
sudo apt update现在您应该能够安装 PHP 7.x和相关模块例如sudo apt-get install php7.4-cli php7.4-mbstring php7.4-xml php7.4-gd php7.4-mysql php7.4-curl 和sudo apt install -y php7.3 php7.3-cli php7.3-fpm php7.3-mysql php7.3-zip php7.3-gd php7.3-mbstring php7.3-curl php7.3-xml php7.3-bcmath
注意根据我的经验您不需要在 apt install 语句中放入 php7.x-common成功安装 php 7.3/7.4 后通用模块将自动安装。