Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Docker: unable to install php intl extention when using php:fpm-alpine official image

I am setting up very basic Docker container for a PHP and Zend framework project. I am using official Docker image php:fpm-alpine. Container is running successfully and I am able to see my application. In order for Zend to work I need PHP intl extention. When I add RUN docker-php-ext-install intl command in DockerFile extention is not installed successfully.

DockerFile code

FROM php:fpm-alpine

WORKDIR /usr/share/nginx/html

RUN docker-php-ext-install mysqli pdo pdo_mysql intl

Any help or recommendation is much appreciated. Thanks in advance.

like image 372
CodeMonger Avatar asked May 14 '20 00:05

CodeMonger


People also ask

What is PHP Intl extension?

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.

Can I run PHP in docker?

You can use docker run to create a container and execute PHP. You just need to add some volumes to the container. These volumes should include the paths to your code.


1 Answers

The installation of intl extension is failing because a dependency is missing for it. Please update your Dockerfile with following and it should work.

FROM php:fpm-alpine    
WORKDIR /usr/share/nginx/html
RUN apk add icu-dev 
RUN docker-php-ext-install mysqli pdo pdo_mysql
RUN docker-php-ext-configure intl && docker-php-ext-install intl
like image 76
Sandeep Sidhu Avatar answered Oct 14 '22 03:10

Sandeep Sidhu