PHP intl extension in Docker container

Marcelo Noguti picture Marcelo Noguti · Feb 7, 2018 · Viewed 20.9k times · Source

I'm trying to load the intl PHP extension in my Docker container, but it doesn't seem to work.

Have already tried this https://github.com/docker-library/php/issues/57 but I still get the same error message:

configure: error: in `/usr/src/php/ext/intl':
configure: error: C++ preprocessor "/lib/cpp" fails sanity check
See `config.log' for more details

My Docker file looks like this:

RUN apt-get -y update \
&& apt-get install -y libicu-dev\
&& docker-php-ext-configure intl \
&& docker-php-ext-install intl

and it's loading from php:fpm

Have anyone gone through this and got to solve the problem? It's getting me nuts.

Answer

Calteran picture Calteran · Aug 26, 2019

Your code worked perfectly for me once I added a space before the backslash terminating the second line of the run command:

RUN apt-get -y update \
&& apt-get install -y libicu-dev \ ### <-- Added space here
&& docker-php-ext-configure intl \
&& docker-php-ext-install intl