codecasts / php-alpine

PHP APK Repository for Alpine Linux
https://github.com/codecasts/php-alpine
482 stars 58 forks source link

[PHP 7.2] iconv extension problem #29

Closed misaon closed 6 years ago

misaon commented 6 years ago

Hi i have problem with install ICONV php extension on alpine 3.7.

My Dockerfile:

# Trust this project public key to trust the PHP packages.
ADD https://php.codecasts.rocks/php-alpine.rsa.pub /etc/apk/keys/php-alpine.rsa.pub

# Environment variables
ENV PHP_PACKAGES="php7-fpm@php php7-mbstring@php php7-mcrypt@php php7-xmlrpc@php php7-sysvsem@php php7-sysvshm@php php7-intl@php php7-session@php php7-opcache@php php7-iconv@php php7-json@php php7-curl@php php7-pdo_sqlite@php php7-mysqlnd@php php7-pdo_mysql@php php7-openssl@php php7-ctype@php php7-gd@php" \
    ESSENTIAL_PACKAGES="nginx supervisor sed py-pip ca-certificates" \
    UTILITY_PACKAGES="bash nano"

# Add the PHP repository and fix ICONV extension
RUN echo "@php https://php.codecasts.rocks/v3.7/php-7.2" >> /etc/apk/repositories

# Configure php/php-fpm
RUN apk --no-cache --progress add $PHP_PACKAGES

...

When i run phpinfo i see this message:

snimek obrazovky 2018-03-13 v 9 54 18

snimek obrazovky 2018-03-13 v 9 55 02

The same problem: https://github.com/docker-library/php/issues/240

Any ideas? Thanks a lot!

misaon commented 6 years ago

Fixed with this "hack":

#####################################################################
######################## FIX iconv extension #######################$
#####################################################################
ENV BUILD_PACKAGES="wget build-base php7-dev autoconf re2c libtool"
RUN apk --no-cache --progress add $BUILD_PACKAGES \
# Install GNU libiconv
&& mkdir -p /opt \
&& cd /opt \
&& wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.15.tar.gz \
&& tar xzf libiconv-1.15.tar.gz \
&& cd libiconv-1.15 \
&& sed -i 's/_GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead");/#if HAVE_RAW_DECL_GETS\n_GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead");\n#endif/g' srclib/stdio.in.h \
&& ./configure --prefix=/usr/local \
&& make \
&& make install \
# Install PHP iconv from source
&& cd /opt \
&& wget http://php.net/distributions/php-7.1.5.tar.gz \
&& tar xzf php-7.1.5.tar.gz \
&& cd php-7.1.5/ext/iconv \
&& phpize \
&& ./configure --with-iconv=/usr/local \
&& make \
&& make install \
&& mkdir -p /etc/php7/conf.d \
&& echo "extension=iconv.so" >> /etc/php7/conf.d/iconv.ini \
# Cleanup
&& apk del $BUILD_PACKAGES \
&& rm -rf /opt \
&& rm -rf /var/cache/apk/* \
&& rm -rf /usr/share/*
#####################################################################
#####################################################################
#####################################################################
hernandev commented 6 years ago

@misaon new builds were published today, please check if the problem persists.

misaon commented 6 years ago

@hernandev Thanks for reply but i rewrite my all my Docker image. I cant check if problem persist.

misaon commented 6 years ago

Problem persist. I found fix in other repository https://github.com/richarvey/nginx-php-fpm/blob/master/Dockerfile#L15

hernandev commented 6 years ago

I'll check this, thanks for reporting.

hernandev commented 6 years ago

screenshot from 2018-04-09 11-53-07

On the latest releases, I cannot reproduce this problem.

Also, images were updated to php-7.2.4 and php-7.1.16, maybe this alone fixes the issue.

Waiting on confirmation.

hernandev commented 6 years ago

If the problem persists, please re-open the issue, or start a new one, and I'll check. Thank you all!