Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PHP intl extension in Docker container

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.

like image 960
Marcelo Noguti Avatar asked Feb 07 '18 22:02

Marcelo Noguti


People also ask

Can I run PHP in docker?

Docker allows you to set your application with each service running as a microservice. This way, you set a single YML file that will isolate all the services that your application needs to run. The file sets up the PHP Apache server and MySQL database for you.

What is Intl extension in PHP?

The Internationalization extension (Intl) is a wrapper for the ICU library, a set of C/C++ and Java libraries that provide Unicode and Globalization support for software applications. It enables PHP programmers to perform UCA-conformant collation and date/time/number/currency formatting in their scripts.

What is docker-PHP-ext-configure?

docker-php-ext-install - build extension from source, usually executes docker-php-ext-configure for build configuration, enables the extension (php.ini entry) by executing docker-php-ext-enable after all. docker-php-ext-enable - enables an already extension by adding a specific entry to php. ini.


1 Answers

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 
like image 121
Calteran Avatar answered Sep 22 '22 05:09

Calteran