Skip to content
This repository was archived by the owner on Oct 8, 2025. It is now read-only.
This repository was archived by the owner on Oct 8, 2025. It is now read-only.

how to add in image  #1030

Closed
Closed

Description

@IvayLoRD

Hello, sorry for the question, it may seem stupid to you, can someone explain how it could be added BC Math
Fileinfo, GMP, Iconv, Intl, MBString, OpenSSL***, SOAP and ionCube Loader for PHP version in image public.ecr.aws/nginx/unit:1.31.1-php8.2 because I didn't see anything like that anywhere .

Activity

  1. thresheek commented on Dec 14, 2023

    @thresheek
    Member

    Hi @IvayLoRD!

    Since this image is based on Docker Official PHP image, you can use the documentation from https://hub.docker.com/_/php section "How to install more PHP extensions".

    Let us know if that works for you!

  2. JanMikes commented on Dec 19, 2023

    @JanMikes

    Hi, you can use either pecl or i recommend installing and using https://github.com/mlocati/docker-php-extension-installer

    COPY --from=mlocati/php-extension-installer /usr/bin/install-php-extensions /usr/local/bin/
    
    RUN install-php-extensions bcmath \
        iconv  ## and more ..
    
  3. javorszky commented on Jan 11, 2024

    @javorszky
    Contributor

    Hi @IvayLoRD,

    I had to install some of these packages on top of a unit image yesterday. Here's my docker file that I used as a base for working with WordPress:

    FROM unit:1.31.1-php8.2
    
    # Install absolutely required packages without which WordPress does not start
    RUN apt update && apt install -y libicu-dev git
    RUN docker-php-ext-install intl pdo_mysql mysqli 
    
    # Install exif, opcache, shmop, sockets, and zip packages
    RUN apt install -y libzip-dev ghostscript
    RUN docker-php-ext-install exif opcache shmop sockets zip
    
    # Install ssh2 php module
    RUN apt install -y libssh2-1-dev libssh2-1
    RUN pecl install ssh2
    RUN docker-php-ext-enable ssh2
    
    # Install imagick extension
    RUN apt install -y libmagickwand-dev
    RUN pecl install imagick
    RUN docker-php-ext-enable imagick
    
    # Install igbinary
    RUN pecl install igbinary
    RUN docker-php-ext-enable igbinary
    
    # Install redis
    RUN pecl install redis
    RUN docker-php-ext-enable redis
    
    # Install image (the php extension "image" per the handbook)
    RUN docker-php-ext-install gd
    
    # Install bc (bcmath)
    RUN docker-php-ext-install bcmath
    
    WORKDIR /wpms/
    
    RUN chown -R unit:unit /wpms/
    

    Your actual needs will be different, but in general the two potential ways of installing packages are

    • either directly through docker-php-ext-install. This list gives me all packages that are installable: bcmath bz2 calendar ctype curl dba dl_test dom enchant exif ffi fileinfo filter ftp gd gettext gmp hash iconv imap intl json ldap mbstring mysqli oci8 odbc opcache pcntl pdo pdo_dblib pdo_firebird pdo_mysql pdo_oci pdo_odbc pdo_pgsql pdo_sqlite pgsql phar posix pspell random readline reflection session shmop simplexml snmp soap sockets sodium spl standard sysvmsg sysvsem sysvshm tidy tokenizer xml xmlreader xmlwriter xsl zend_test zip
    • or through pecl, and then docker-php-ext-enable

    For more info see https://hub.docker.com/_/php, the "How to install more PHP extensions heading"

    Alternatively the way @JanMikes showed would also work.

  4. locked and limited conversation to collaborators on Jan 18, 2024
  5. converted this issue into a discussion #1071 on Jan 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions