Skip to content

Problem with php-cli-alpine. Only for alpine version > 3.13 version. (docker-compose, php v7.4, php v8.1) #1272

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Eugentis opened this issue Mar 20, 2022 · 5 comments
Labels
question Usability question, not directly related to an error with the image

Comments

@Eugentis
Copy link

Hi
Last week I've detected that php:8.1-cli-alpine (same as php:7.4-cli-alpine with alpine version more than 3.13) have some problems with install iconv via docker-php-ext-install iconv

I have Dockerfile with lines like:

FROM php:8.1-cli-alpine3.14
....
RUN apk update \
    && apk add --no-cache  \
        oniguruma \
        oniguruma-dev \
        libgcrypt \
        libgcrypt-dev \
        libressl-dev \
        ca-certificates \
        pcre-dev \
        curl \
        libcurl \
        git \
        openssh-client \
        openssl-dev \
        wget \
        libmcrypt-dev \
        freetype-dev libpng-dev libjpeg-turbo-dev libxml2-dev autoconf g++ imagemagick-dev imagemagick libtool make \
        icu-dev \
        libxslt-dev \
        zip \
        nano \
        patch \
        gnu-libiconv \
        tmux \
        bash \
        libzip-dev \
        ${PHPIZE_DEPS} \
    && rm -rf /var/lib/apt/lists/*
...
RUN docker-php-ext-install \
        mbstring opcache iconv pdo \
        pdo pdo_mysql \
        gd dom exif intl json soap tokenizer xsl zip pcntl bcmath sockets \
        && docker-php-source delete \
        && apk del ${BUILD_DEPENDS}
...

And it fails at iconv install (checked on step-by-step allocation)

#10 71.54 In file included from /usr/src/php/ext/iconv/iconv.c:20:
#10 71.54 /usr/src/php/ext/iconv/config.h:56: note: this is the location of the previous definition
#10 71.54    56 | #define ICONV_BROKEN_IGNORE 1
#10 71.54       | 
#10 71.74 /usr/src/php/ext/iconv/iconv.c: In function 'zm_startup_miconv':
#10 71.74 /usr/src/php/ext/iconv/iconv.c:197:4: error: '_libiconv_version' undeclared (first use in this function)
#10 71.74   197 |    _libiconv_version >> 8, _libiconv_version & 0xff);
#10 71.74       |    ^~~~~~~~~~~~~~~~~
#10 71.74 /usr/src/php/ext/iconv/iconv.c:197:4: note: each undeclared identifier is reported only once for each function it appears in
#10 71.75 /usr/src/php/ext/iconv/iconv.c: In function '_php_iconv_appendl':
#10 71.75 /usr/src/php/ext/iconv/iconv.c:97:15: warning: implicit declaration of function 'libiconv'; did you mean 'zif_iconv'? [-Wimplicit-function-declaration]
#10 71.75    97 | #define iconv libiconv
#10 71.75       |               ^~~~~~~~
#10 71.75 /usr/src/php/ext/iconv/iconv.c:363:8: note: in expansion of macro 'iconv'
#10 71.75   363 |    if (iconv(cd, (char **)&in_p, &in_left, (char **) &out_p, &out_left) == (size_t)-1) {
#10 71.75       |        ^~~~~
#10 71.79 make: *** [Makefile:205: iconv.lo] Error 1

Project with php 7.4 worked fine about two weeks ago. No changes were made with docker files but at last week it fails.
The project was fixed by changing to version php:7.4-cli-alpine3.13.
But it can be made for php:8.1-cli-alpine project

Can you help to fix it?

@JerryVerhoef
Copy link

JerryVerhoef commented Mar 20, 2022

Same problem. With this smaller dockerfile:

FROM php:7.4.28-fpm-alpine3.15

RUN  docker-php-ext-install iconv

Tags which are not working for me: php:7.4.28-fpm-alpine3.15, php:7.4.28-fpm-alpine3.14, php:fpm-alpine, php::8.1.3-fpm-alpine3.15. I think all latest alpine images are broken.
The previous version is working for me: php:7.4.27-fpm-alpine3.15

Maybe related to: #1264

@JerryVerhoef
Copy link

It seems that iconv is enabled by default so removing it seems to be working fine.

@jonathantullett
Copy link

Yes, enabled by default:

$ docker run php:8.1.4-fpm-alpine3.15 php -m | grep iconv
iconv

@Eugentis
Copy link
Author

@jonathantullett @JerryVerhoef Thanks for help with php8. Forgot to check it....

@wglambert wglambert added the question Usability question, not directly related to an error with the image label Mar 21, 2022
@wglambert
Copy link

Yep it's already in the image, also see #1264
And https://github.com/docker-library/docs/tree/master/php#how-to-install-more-php-extensions

Many extensions are already compiled into the image, so it's worth checking the output of php -m or php -i before going through the effort of compiling more.

$ docker run --rm php:8.1.4-fpm-alpine3.15 php -i | grep iconv
Configure Command =>  './configure'  '--build=x86_64-linux-musl' '--with-config-file-path=/usr/local/etc/php' '--with-config-file-scan-dir=/usr/local/etc/php/conf.d' '--enable-option-checking=fatal' '--with-mhash' '--with-pic' '--enable-ftp' '--enable-mbstring' '--enable-mysqlnd' '--with-password-argon2' '--with-sodium=shared' '--with-pdo-sqlite=/usr' '--with-sqlite3=/usr' '--with-curl' '--with-iconv=/usr' '--with-openssl' '--with-readline' '--with-zlib' '--disable-phpdbg' '--with-pear' '--disable-cgi' '--enable-fpm' '--with-fpm-user=www-data' '--with-fpm-group=www-data' 'build_alias=x86_64-linux-musl'
Registered Stream Filters => zlib.*, convert.iconv.*, string.rot13, string.toupper, string.tolower, convert.*, consumed, dechunk
iconv
iconv support => enabled
iconv implementation => libiconv
iconv library version => 1.16
iconv.input_encoding => no value => no value
iconv.internal_encoding => no value => no value
iconv.output_encoding => no value => no value

In php:alpine-3.13 iconv was also already enabled

$ docker run --rm php:fpm-alpine3.13 php -i | grep iconv
Registered Stream Filters => zlib.*, convert.iconv.*, string.rot13, string.toupper, string.tolower, convert.*, consumed, dechunk
iconv
iconv support => enabled
iconv implementation => unknown
iconv library version => unknown
iconv.input_encoding => no value => no value
iconv.internal_encoding => no value => no value
iconv.output_encoding => no value => no value

Closing since this is resolved

ict-21-nib-sakai added a commit to ict-21-nib-sakai/lamp81-laravel-template that referenced this issue Apr 28, 2022
- php:8.1.3-cli-alpine3.15 から
- php:8.1.5-cli-alpine3.15 に変更。

iconv はデフォルトで有効になっているため除外した。
@see docker-library/php#1272 (comment)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Usability question, not directly related to an error with the image
Projects
None yet
Development

No branches or pull requests

4 participants