Home  >  Q&A  >  body text

Install timezonedb in docker image

<p>How to set <code>extension=timezonedb.so</code> in docker PHP image? Installed timezonedb in docker bash manual and added <code>extension=timezonedb.so</code> to php.ini but didn't work for me. </p> <p>Install timezonedb in docker bash manual and add <code>extension=timezonedb.so</code> to php.ini but it doesn't work for me. </p>
P粉158473780P粉158473780438 days ago409

reply all(1)I'll reply

  • P粉696146205

    P粉6961462052023-09-01 09:01:12

    https://serverfault.com/questions/1123233/why-timezonedb-extension-have-the-latest-data

    method one.

    RUN docker-php-source extract \
        && pecl bundle -d /usr/src/php/ext timezonedb \
        && docker-php-ext-configure timezonedb \
        && docker-php-ext-install -j$(nproc) timezonedb \
        && docker-php-source delete

    Method 2.

    RUN mkdir -p /usr/local/src/pecl \
        && pecl bundle -d /usr/local/src/pecl timezonedb \
        && docker-php-ext-configure /usr/local/src/pecl/timezonedb \
        && docker-php-ext-install -j$(nproc) /usr/local/src/pecl/timezonedb \
        && rm -rf /usr/local/src/pecl

    Method 3.

    RUN apt-get -y install gcc make autoconf libc-dev pkg-config \
        && pecl install timezonedb \
        && bash -c "echo extension=timezonedb.so > /usr/local/etc/php/conf.d/docker-php-ext-timezonedb.ini"

    These 3 methods all work fine. After building the docker container, I confirmed that the extension was installed and loaded correctly by checking the PHP information.

    reply
    0
  • Cancelreply