Home > front end >  phpize failed when building php-fpm for docker after updating mac os
phpize failed when building php-fpm for docker after updating mac os

Time:09-21

I have lost the ability to build php images for docker after i've updated my mac os from 11.4 to 11.6. Before updating everything was building smoothly, but just after updating i can't seem to build php-fpm with any additional extensions at all.

So if i have Dockerfile without any extension at all the image will build

FROM php:7.4-fpm
RUN apt-get update && apt-get install -y \
        curl \
        wget \
        git \
        libfreetype6-dev \
        libjpeg62-turbo-dev \
        zlib1g-dev \
        libpng-dev \
        libonig-dev \
        libzip-dev \
        libmcrypt-dev \
        libpq-dev 

CMD ["php-fpm"]

But if i have any extension at all in my dockerfile the build will fail while trying to install the first one. So with a dockerfile like this

FROM php:7.4-fpm

RUN apt-get update && apt-get install -y \
        curl \
        wget \
        git \
        libfreetype6-dev \
        libjpeg62-turbo-dev \
        zlib1g-dev \
        libpng-dev \
        libonig-dev \
        libzip-dev \
        libmcrypt-dev \
        libpq-dev 

RUN pecl install mcrypt-1.0.4
RUN docker-php-ext-enable mcrypt

RUN docker-php-ext-install -j$(nproc) iconv
RUN docker-php-ext-install -j$(nproc) mbstring
RUN docker-php-ext-install -j$(nproc) mysqli
RUN docker-php-ext-install -j$(nproc) pdo_mysql
RUN docker-php-ext-install -j$(nproc) zip
RUN pecl install -o redis && docker-php-ext-enable redis

CMD ["php-fpm"]

I'm getting error like this

 => ERROR [ 3/12] RUN pecl install mcrypt-1.0.4                                                     3.7s
------                                                                                                   
 > [ 3/12] RUN pecl install mcrypt-1.0.4:                                                                
#6 3.043 downloading mcrypt-1.0.4.tgz ...                                                                
#6 3.044 Starting to download mcrypt-1.0.4.tgz (27,056 bytes)                                            
#6 3.157 .........done: 27,056 bytes                                                                     
#6 3.196 6 source files, building                                                                        
#6 3.196 running: phpize
#6 3.208 Configuring for:
#6 3.208 PHP Api Version:         20190902
#6 3.208 Zend Module Api No:      20190902
#6 3.208 Zend Extension Api No:   320190902
#6 3.354 Use of uninitialized value $type in string eq at /usr/bin/autom4te line 272, <GEN0> line 66.
#6 3.354 Use of uninitialized value $type in string eq at /usr/bin/autom4te line 278, <GEN0> line 66.
#6 3.355 Use of uninitialized value $type in string eq at /usr/bin/autom4te line 284, <GEN0> line 66.
#6 3.355 Use of uninitialized value $type in concatenation (.) or string at /usr/bin/autom4te line 292, <GEN0> line 66.
#6 3.355 autom4te: /usr/share/autoconf/autom4te.cfg:66: unknown directive:
#6 3.718 ERROR: `phpize' failed
------
executor failed running [/bin/sh -c pecl install mcrypt-1.0.4]: exit code: 1

Depending on extension i'm trying to install the errors will be a little bit different

=> ERROR [3/8] RUN docker-php-ext-install -j$(nproc) iconv                                         4.2s
------                                                                                                   
 > [3/8] RUN docker-php-ext-install -j$(nproc) iconv:                                                    
#6 3.155 Configuring for:                                                                                
#6 3.155 PHP Api Version:         20190902                                                               
#6 3.155 Zend Module Api No:      20190902                                                               
#6 3.155 Zend Extension Api No:   320190902                                                              
#6 3.769 Can't export symbol: US_GLOBAL at /usr/share/autoconf/Autom4te/FileUtils.pm line 42.
#6 3.769 BEGIN failed--compilation aborted at /usr/share/autoconf/Autom4te/FileUtils.pm line 42.
#6 3.769 Compilation failed in require at /usr/bin/autom4te line 40.
#6 3.769 BEGIN failed--compilation aborted at /usr/bin/autom4te line 40.
#6 3.772 autoheader: '/usr/bin/autom4te' failed with exit status: 255
------
executor failed running [/bin/sh -c docker-php-ext-install -j$(nproc) iconv]: exit code: 1

But still a wasn't able to find anything about these errors at all.

I've tried reinstalling developer tools and brew, but still can't build a php image with any extensions at all.

CodePudding user response:

i have spent 4 days, googled like crazy, completely uninstalled my system quite a number of times, including installing a beta version of mac os 10.12 but...

...for some absolutely bizarre reason the image won't build with FROM php:7.4-fpm (though it was successfully building before) but will build with FROM php:7.4.0-fpm in Dockerfile

  • Related