gpt4 book ai didi

php - 在 php :7. 4-fpm 镜像上安装 PHP-zip

转载 作者:行者123 更新时间:2023-12-02 21:30:55 25 4
gpt4 key购买 nike

我想在我的 docker 镜像上安装 php-zip(最终目标是使用 PhpWord 库)。我使用在 Debian 上运行的 php:7.4-fpm。
在我的 dockerfile 中,我使用以下命令:

RUN apt-get update docker-php-ext-install zip
执行时,脚本崩溃,因为它找不到/usr/src/php/ext/libzip。
所以我添加了一个很好的旧“apt-get install libzip”,但它找不到包。如果它尝试安装“libzip4”,同样的事情:
checking for libzip >= 0.11 libzip != 1.3.1 libzip != 1.7.0... no
configure: error: Package requirements (libzip >= 0.11 libzip != 1.3.1 libzip != 1.7.0) were not met:

No package 'libzip' found
No package 'libzip' found
No package 'libzip' found

Consider adjusting the PKG_CONFIG_PATH environment variable if you installed software in a non-standard prefix.

Alternatively, you may set the environment variables LIBZIP_CFLAGS and LIBZIP_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.
ERROR: Service 'webapi' failed to build : The command '/bin/sh -c apt-get update && apt-get install libzip4 && docker-php-ext-install zip' returned a non-zero code: 1
我假设 libzip4 不是有效版本,或者它无法在 libzip 和 libzip4 之间建立链接。
主要问题是,如果没有那个库,我就卡住了,根本无法安装扩展。此外,当谈到 docker 时,我还是个菜鸟,所以我呼吁您的帮助!
谢谢你的时间 !

最佳答案

好的,所以问题是您必须猜测您需要安装的包称为“libzip-dev”,而不仅仅是“libzip”。
所以解决方案是:

RUN apt-get update \
&& apt-get install -y libzip-dev \
&& docker-php-ext-install zip

关于php - 在 php :7. 4-fpm 镜像上安装 PHP-zip,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64500293/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com