我想在我的 docker 映像上安装 php-zip (最终目标是使用 PhpWord 库)。我使用 php:7.4-fpm,它在 Debian 上运行。
在我的 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
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)