gpt4 book ai didi

php - 在 php :7. 2-fpm-alpine 自定义 docker 图像中安装 xmlreader 需要什么库?

转载 作者:行者123 更新时间:2023-12-02 18:13:33 28 4
gpt4 key购买 nike

为此 Composer package我需要将 xmlreader 添加到我的自定义 docker php 镜像中:

FROM php:7.2-fpm-alpine

RUN apk add --update libzip-dev libmcrypt-dev libpng-dev libjpeg-turbo-dev libxml2-dev icu-dev postgresql-dev curl-dev libmemcached-dev &&\
apk add --update --virtual build-dependencies build-base gcc wget autoconf &&\
docker-php-ext-install gd && \
docker-php-ext-install zip &&\
docker-php-ext-install dom xml xmlwriter xmlreader &&\
apk del build-dependencies &&\
rm -rf /var/cache/apk/*

但是当我构建它时出现以下错误:

/usr/src/php/ext/xmlreader/php_xmlreader.c:32:10: fatal error: ext/dom/dom_ce.h: No such file or directory
#include "ext/dom/dom_ce.h"
^~~~~~~~~~~~~~~~~~
compilation terminated.
make: *** [Makefile:194: php_xmlreader.lo] Error 1
Removing intermediate container 0b3f031b2479

所以我假设我缺少一些库,但我缺少哪个库?

显然 dom 扩展也需要通过 docker-php-ext-install 安装,我还需要 libxml2-dev也已安装。

最佳答案

The XMLWriter extension was initially a PECL extension for PHP 5. It was later added to the PHP source (bundled) as of PHP 5.1.2. This extension is enabled by default.

The XMLReader extension was initially a PECL extension for PHP 5. It was later moved to the PHP source (bundled) as of PHP 5.1.0, and later enabled by default as of PHP 5.1.2.

您需要移除dom、xmlwriter 和xmlreader

FROM php:7.2-fpm-alpine

RUN apk add --update libzip-dev libmcrypt-dev libpng-dev libjpeg-turbo-dev libxml2-dev icu-dev postgresql-dev curl-dev libmemcached-dev &&\
apk add --update --virtual build-dependencies build-base gcc wget autoconf && \
docker-php-ext-install gd && \
docker-php-ext-install zip &&\
docker-php-ext-install xml &&\
apk del build-dependencies &&\
rm -rf /var/cache/apk/*

我检查过,工作正常。希望对你有帮助。

关于php - 在 php :7. 2-fpm-alpine 自定义 docker 图像中安装 xmlreader 需要什么库?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59784434/

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