问题
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.
回答1:
It seems some requirements are missing. The snippet below worked for me:
ARG PHP_VERSION=5.6
FROM php:${PHP_VERSION}-fpm-jessie
apt-get install -y zlib1g-dev libicu-dev g++ \
&& docker-php-ext-configure intl \
&& docker-php-ext-install intl
回答2:
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
回答3:
Unfortunately, some php extensions have dependencies to other programs. There is a project called docker-php-extension-installer that you can use to install PHP extensions. It will make sure that the required dependencies are present as well. See https://stackoverflow.com/a/56224300/413531 for an example how I actually integrate it in a Dockerfile.
来源:https://stackoverflow.com/questions/48674297/php-intl-extension-in-docker-container