phpdockerapacheintl

Installing PHP extension 'intl' on a PHP Docker image


I'm having trouble installing the intl extension on the official php:8.1-apache Docker image running on Debian.

I've tried running the following commands:

apt install cron coreutils g++ zip unzip icu-dev libicu-dev libpng-dev libxml2-dev libzip-dev libonig-dev libxslt-dev php8.1-intl -y
docker-php-ext-configure intl
docker-php-ext-install pdo pdo_mysql mysqli gd opcache intl zip calendar dom mbstring xsls
docker-php-ext-enable intl
echo "extension=intl" >> /usr/local/etc/php/conf.d/docker-php-ext-intl.ini

I´m tested not all at once. However, none of these solutions have worked for me. Can anyone suggest the correct configurations for this image? Thanks in advance for your help.

Some error logs on running

Warning: PHP Startup: Unable to load dynamic library 'intl' (tried: /usr/local/lib/php/extensions/no-debug-non-zts-20210902/intl (/usr/local/lib/php/extensions/no-debug-non-zts-20210902/intl: cannot open shared object file: No such file or directory), /usr/local/lib/php/extensions/no-debug-non-zts-20210902/intl.so (/usr/local/lib/php/extensions/no-debug-non-zts-20210902/intl.so: cannot open shared object file: No such file or directory)) in Unknown on line 0


Solution

  • I'm not sure why it didn't work back then. Apparently, I got stuck somewhere. The following commands work perfectly:

    apt install libicu-dev -y
    docker-php-ext-install intl
    docker-php-ext-enable intl