安装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,如果安装其他组件也需要这样的问题,应该如何解决?
//: <> (能截图就截图。)

4. 您实际得到的结果?

《L04 微信小程序从零到发布》
从小程序个人账户申请开始,带你一步步进行开发一个微信小程序,直到提交微信控制台上线发布。
《L03 构架 API 服务器》
你将学到如 RESTFul 设计风格、PostMan 的使用、OAuth 流程,JWT 概念及使用 和 API 开发相关的进阶知识。
讨论数量: 6

可以这样:
这个错误表明在尝试安装软件时,存在一些依赖关系问题或损坏的软件包。以下是一些建议来解决这个问题:

  1. 更新软件包列表和升级系统:
sudo apt-get update
sudo apt-get upgrade
  1. 尝试修复已安装的软件包:
sudo apt-get -f install
  1. 清理本地缓存和不再需要的软件包:
sudo apt-get clean
sudo apt-get autoremove
  1. 使用aptitude工具解决依赖关系问题:

首先,确保已经安装了aptitude

sudo apt-get install aptitude

然后,尝试使用aptitude安装软件:

sudo aptitude install <package-name>

aptitude会尝试找到一个合适的解决方案来解决依赖关系问题。

  1. 如果以上方法都无法解决问题,可以尝试手动下载软件包并安装。首先,从官方网站或其他可靠来源下载软件包的.deb文件。然后,使用dpkg命令安装:
sudo dpkg -i <package-name>.deb

如果安装过程中出现依赖关系问题,可以使用apt-get来解决:

sudo apt-get install -f

请注意,这些方法可能不适用于所有情况。在某些情况下,可能需要更深入地研究问题并手动解决依赖关系。

推荐还是使用dnmp或者laradockergithub.com/yeszao/dnmp

5个月前 评论

github.com/php/php-src/issues/1591... 一起给官方提issue吧,让官方出二进制包吧。

5个月前 评论

Linux里装docker 一把梭

5个月前 评论

讨论应以学习和精进为目的。请勿发布不友善或者负能量的内容,与人为善,比聪明更重要!