docker-library / php

Docker Official Image packaging for PHP
https://php.net
MIT License
3.81k stars 2k forks source link

docker-php-ext-install intl #1457

Closed pws2016 closed 10 months ago

pws2016 commented 11 months ago

Hello i'm beginner with docker and i want add the extension intl. In my file docker i write this:

FROM php:7.4-apache
RUN apt-get update && apt-get install -y \
    zip \
    unzip
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
ADD https://github.com/mlocati/docker-php-extension-installer/releases/latest/download/install-php-extensions /usr/local/bin/

RUN chmod +x /usr/local/bin/install-php-extensions && \
    docker-php-ext-configure intl && \
    docker-php-ext-install intl && \
   install-php-extensions @composer gd mysqli zip bcmath amqp

But i get error as :

 > [php 5/5] RUN chmod +x /usr/local/bin/install-php-extensions &&     docker-php-ext-configure intl &&     docker-php-ext-install intl &&    install-php-extensions @composer gd mysqli zip bcmath amqp:
1.562 Configuring for:
1.562 PHP Api Version:         20190902
1.562 Zend Module Api No:      20190902
1.562 Zend Extension Api No:   320190902
2.069 checking for grep that handles long lines and -e... /bin/grep
2.070 checking for egrep... /bin/grep -E
2.071 checking for a sed that does not truncate output... /bin/sed
2.089 checking for pkg-config... /usr/bin/pkg-config
2.090 checking pkg-config is at least version 0.9.0... yes
2.096 checking for cc... cc
2.112 checking whether the C compiler works... yes
2.196 checking for C compiler default output file name... a.out
2.197 checking for suffix of executables...
2.221 checking whether we are cross compiling... no
2.258 checking for suffix of object files... o
2.272 checking whether we are using the GNU C compiler... yes
2.286 checking whether cc accepts -g... yes
2.301 checking for cc option to accept ISO C89... none needed
2.333 checking how to run the C preprocessor... cc -E
2.371 checking for icc... no
2.378 checking for suncc... no
2.384 checking for system library directory... lib
2.384 checking if compiler supports -R... no
2.392 checking if compiler supports -Wl,-rpath,... yes
2.421 checking build system type... x86_64-pc-linux-gnu
2.425 checking host system type... x86_64-pc-linux-gnu
2.426 checking target system type... x86_64-pc-linux-gnu
2.450 checking for PHP prefix... /usr/local
2.450 checking for PHP includes... -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib
2.450 checking for PHP extension directory... /usr/local/lib/php/extensions/no-debug-non-zts-20190902
2.450 checking for PHP installed headers prefix... /usr/local/include/php
2.450 checking if debug is enabled... no
2.483 checking if zts is enabled... no
2.507 checking for gawk... no
2.507 checking for nawk... nawk
2.508 checking if nawk is broken... no
2.510 checking whether to enable internationalization support... yes, shared
2.511 checking for icu-uc >= 50.1 icu-io icu-i18n... no
2.516 configure: error: Package requirements (icu-uc >= 50.1 icu-io icu-i18n) were not met:
2.516
2.516 No package 'icu-uc' found
2.516 No package 'icu-io' found
2.516 No package 'icu-i18n' found
2.516
2.516 Consider adjusting the PKG_CONFIG_PATH environment variable if you
2.516 installed software in a non-standard prefix.
2.516
2.516 Alternatively, you may set the environment variables ICU_CFLAGS
2.516 and ICU_LIBS to avoid the need to call pkg-config.
2.516 See the pkg-config man page for more details.
------
failed to solve: process "/bin/sh -c chmod +x /usr/local/bin/install-php-extensions &&     docker-php-ext-configure intl &&     docker-php-ext-install intl &&    install-php-extensions @composer gd mysqli zip bcmath amqp" did not complete successfully: exit code: 1

How i must update my file to resolve this? Thanks

LaurentGoderre commented 11 months ago

The following worked for me

RUN set -eux; \
    apt-get update; \
    apt-get install -y\
        libicu-dev; \
    docker-php-ext-install intl; \
    rm -rf /var/lib/apt/lists/*;
K2ouMais commented 11 months ago

For some weird reasons I am having the same issue installing the "intl" package.

This is the error I am getting:

Warning: PHP Startup: Unable to load dynamic library 'intl.so' (tried: /usr/local/lib/php/extensions/no-debug-non-zts-20220829/intl.so (Error loading shared library libicuio.so.73: No such file or directory (needed by /usr/local/lib/php/extensions/no-debug-non-zts-20220829/intl.so)), /usr/local/lib/php/extensions/no-debug-non-zts-20220829/intl.so.so (Error loading shared library /usr/local/lib/php/extensions/no-debug-non-zts-20220829/intl.so.so: No such file or directory)) in Unknown on line 0

I am using the official php:8.2-fpm-alpine image.

LaurentGoderre commented 10 months ago

This works for Alpine variants

FROM php:8.2-fpm-alpine

RUN set -eux; \
    apk add --no-cache \
        icu-dev; \
    docker-php-ext-install intl;
talha-core commented 10 months ago

I am having the same issue, this is my Dockerfile:

FROM php:7.4.22-apache

RUN a2enmod rewrite

RUN apt-get update \
    && apt-get install -y zlib1g-dev g++ git libicu-dev unzip zip libzip-dev zip libxml2-dev libonig-dev libcurl3-openssl-dev npm\
    && docker-php-ext-install intl opcache pdo pdo_mysql mysqli soap mbstring xml curl\
    && pecl install apcu \
    && docker-php-ext-enable apcu \
    && docker-php-ext-configure zip \
    && docker-php-ext-install zip
LaurentGoderre commented 10 months ago

@talha-core that builds successfully for me

tianon commented 10 months ago

Since we can't reproduce a failure, I'm sorry but there's not much we can do here. :see_no_evil: