安装WSL2的ubuntu后,无法安装php8.0和php7.4
1. 运行环境
win11 + WSL2 +Ubuntu +docker desktop
1). 当前使用的 Laravel 版本?
部署环境
//: <> (使用 php artisan --version
命令查看)
2). 当前使用的 php/php-fpm 版本?
PHP 版本:
php-fpm 版本:
3). 当前系统
Windows 11 / Ubuntu 22.4.03 tls / Ubuntu 24.04
4). 业务环境
5). 相关软件版本
2. 问题描述?
在ubuntu中安装php8.0和7.4时,提示
//: <> (代码问题的话,请提供一份最短的,可复现问题的代码。或者相关代码)
:~$ sudo apt install -y php8.0-cli php8.0-dev php8.0-pgsql php8.0-sqlite3 php8.0-gd php8.0-curl php8.0-memcached php8.0-imap php8.0-mysql php8.0-mbstring php8.0-xml php8.0-zip php8.0-bcmath php8.0-soap php8.0-intl php8.0-readline php8.0-msgpack php8.0-igbinary php8.0-ldap php8.0-redis
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:
libc6-dev : Depends: libc6 (= 2.31-0ubuntu9.16) but 2.35-0ubuntu3.4 is to be installed
Depends: libc-dev-bin (= 2.31-0ubuntu9.16) but it is not going to be installed
Depends: libcrypt-dev but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
无法安装libc6提示依赖的包已经安装了,安装了高版本的包
3. 您期望得到的结果?
在Windows的应用商店搜索不到 Ubuntu 20.04LTS,只有高版本的Ubuntu了,怎么样能够安装上php,如果安装其他组件也需要这样的问题,应该如何解决?
//: <> (能截图就截图。)
可以这样:
这个错误表明在尝试安装软件时,存在一些依赖关系问题或损坏的软件包。以下是一些建议来解决这个问题:
aptitude
工具解决依赖关系问题:首先,确保已经安装了
aptitude
:然后,尝试使用
aptitude
安装软件:aptitude
会尝试找到一个合适的解决方案来解决依赖关系问题。.deb
文件。然后,使用dpkg
命令安装:如果安装过程中出现依赖关系问题,可以使用
apt-get
来解决:请注意,这些方法可能不适用于所有情况。在某些情况下,可能需要更深入地研究问题并手动解决依赖关系。
推荐还是使用
dnmp
或者laradocker
:github.com/yeszao/dnmpgithub.com/php/php-src/issues/1591... 一起给官方提issue吧,让官方出二进制包吧。
博客:Ubuntu pecl 多版本 PHP 安装扩展,避免冲突 看看这个
Linux里装docker 一把梭
ubuntu2204